Class: YiffSpace::Utils::TableBuilder::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/yiffspace/utils/table_builder.rb

Overview

Represents a custom row in the table body.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row_attributes = {}, &block) ⇒ Row

Returns a new instance of Row.



86
87
88
89
# File 'lib/yiffspace/utils/table_builder.rb', line 86

def initialize(row_attributes = {}, &block)
  @row_attributes = row_attributes
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



84
85
86
# File 'lib/yiffspace/utils/table_builder.rb', line 84

def block
  @block
end

#row_attributesObject (readonly)

Returns the value of attribute row_attributes.



84
85
86
# File 'lib/yiffspace/utils/table_builder.rb', line 84

def row_attributes
  @row_attributes
end

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/yiffspace/utils/table_builder.rb', line 91

def custom?
  true
end

#value(index) ⇒ Object



95
96
97
98
99
100
101
102
# File 'lib/yiffspace/utils/table_builder.rb', line 95

def value(index)
  view = block.binding.receiver
  if view.respond_to?(:capture)
    view.capture { block.call(index, self) }
  else
    block.call(index, self)
  end
end