Class: FlexiView::Meta

Inherits:
Object
  • Object
show all
Defined in:
lib/flexi_view/meta.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, root_key, &data_block) ⇒ Meta

Returns a new instance of Meta.



7
8
9
10
11
# File 'lib/flexi_view/meta.rb', line 7

def initialize(name, root_key, &data_block)
  @name = name
  @root_key = root_key
  @data_block = data_block if block_given?
end

Instance Attribute Details

#data_blockObject

Returns the value of attribute data_block.



5
6
7
# File 'lib/flexi_view/meta.rb', line 5

def data_block
  @data_block
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/flexi_view/meta.rb', line 5

def name
  @name
end

#root_keyObject

Returns the value of attribute root_key.



5
6
7
# File 'lib/flexi_view/meta.rb', line 5

def root_key
  @root_key
end

Instance Method Details

#to_data(serializer) ⇒ Object



13
14
15
# File 'lib/flexi_view/meta.rb', line 13

def to_data(serializer)
  serializer.instance_exec(serializer.objects, &data_block)
end