Class: EasySerializer::Collection

Inherits:
Field
  • Object
show all
Defined in:
lib/easy_serializer/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Field

#cache_key, #cache_options, #catch?, #get_value, #nested_serializer, #send_method, #serialize!, #serializer, #serializer?

Methods included from Helpers

#option_to_value

Constructor Details

#initialize(name, options, block) ⇒ Collection

Returns a new instance of Collection.



4
5
6
7
8
# File 'lib/easy_serializer/collection.rb', line 4

def initialize(name, options, block)
  @name = name
  @_options = options
  @block = block
end

Instance Attribute Details

#_optionsObject (readonly)

Returns the value of attribute _options.



3
4
5
# File 'lib/easy_serializer/collection.rb', line 3

def _options
  @_options
end

#blockObject (readonly)

Returns the value of attribute block.



3
4
5
# File 'lib/easy_serializer/collection.rb', line 3

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/easy_serializer/collection.rb', line 3

def name
  @name
end

Instance Method Details

#optionsObject



10
11
12
# File 'lib/easy_serializer/collection.rb', line 10

def options
  received_opts.merge(collection: true)
end

#received_optsObject



14
15
16
# File 'lib/easy_serializer/collection.rb', line 14

def received_opts
  _options || {}
end