Class: LotusAdmin::Exporter::Column

Inherits:
Object
  • Object
show all
Defined in:
app/services/lotus_admin/exporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_name, title, &block) ⇒ Column

Returns a new instance of Column.



17
18
19
20
21
# File 'app/services/lotus_admin/exporter.rb', line 17

def initialize(attribute_name, title, &block)
  @attribute_name = attribute_name
  @title = title
  @block = block || ->(model){ model.public_send(attribute_name) }
end

Instance Attribute Details

#attribute_nameObject (readonly)

Returns the value of attribute attribute_name.



16
17
18
# File 'app/services/lotus_admin/exporter.rb', line 16

def attribute_name
  @attribute_name
end

#blockObject (readonly)

Returns the value of attribute block.



16
17
18
# File 'app/services/lotus_admin/exporter.rb', line 16

def block
  @block
end

#titleObject (readonly)

Returns the value of attribute title.



16
17
18
# File 'app/services/lotus_admin/exporter.rb', line 16

def title
  @title
end

Instance Method Details

#data(model) ⇒ Object



23
24
25
# File 'app/services/lotus_admin/exporter.rb', line 23

def data(model)
  block.call(model)
end