lib/alba/resource.rb in alba-2.1.0 vs lib/alba/resource.rb in alba-2.2.0

- old
+ new

@@ -9,11 +9,11 @@ module Alba # This module represents what should be serialized module Resource # @!parse include InstanceMethods # @!parse extend ClassMethods - DSLS = {_attributes: {}, _key: nil, _key_for_collection: nil, _meta: nil, _transform_type: :none, _transforming_root_key: false, _on_error: nil, _on_nil: nil, _layout: nil, _collection_key: nil}.freeze # rubocop:disable Layout/LineLength + DSLS = {_attributes: {}, _key: nil, _key_for_collection: nil, _meta: nil, _transform_type: :none, _transforming_root_key: false, _key_transformation_cascade: true, _on_error: nil, _on_nil: nil, _layout: nil, _collection_key: nil}.freeze # rubocop:disable Layout/LineLength private_constant :DSLS WITHIN_DEFAULT = Object.new.freeze private_constant :WITHIN_DEFAULT @@ -76,11 +76,10 @@ # Returns a Hash correspondng {Resource#serialize} # # @param root_key [Symbol, nil, true] # @param meta [Hash] metadata for this seialization - # @param symbolize_root_key [Boolean] determines if root key should be symbolized # @return [Hash] def as_json(root_key: nil, meta: {}) key = root_key.nil? ? fetch_key : root_key.to_s if key && !key.empty? h = {key => serializable_hash} @@ -440,11 +439,11 @@ @_meta = block end # Set layout # - # @params file [String] name of the layout file - # @params inline [Proc] a proc returning JSON string or a Hash representing JSON + # @param file [String] name of the layout file + # @param inline [Proc] a proc returning JSON string or a Hash representing JSON def layout(file: nil, inline: nil) @_layout = Layout.new(file: file, inline: inline) end # Transform keys as specified type