Class: Latex::RowFamily

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-latex.rb

Direct Known Subclasses

SingleRowFamily

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns) ⇒ RowFamily

Returns a new instance of RowFamily.



146
147
148
149
150
151
# File 'lib/ruby-latex.rb', line 146

def initialize(columns)
    @columns = columns
    @rows = []
    
    @styler     = proc { |e| e }
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



144
145
146
# File 'lib/ruby-latex.rb', line 144

def columns
  @columns
end

#rowsObject (readonly)

Returns the value of attribute rows.



143
144
145
# File 'lib/ruby-latex.rb', line 143

def rows
  @rows
end

Instance Method Details

#<<(row) ⇒ Object



165
166
167
168
169
# File 'lib/ruby-latex.rb', line 165

def <<(row)
    row.family = self
    
    @rows << row
end

#format(element, col) ⇒ Object



157
158
159
# File 'lib/ruby-latex.rb', line 157

def format(element, col)
    @columns[col].formatter.call(element)
end

#formatter=(formatter) ⇒ Object



171
172
173
# File 'lib/ruby-latex.rb', line 171

def formatter=(formatter)
    @formatter = formatter
end

#style(element) ⇒ Object



161
162
163
# File 'lib/ruby-latex.rb', line 161

def style(element)
    @styler.call(element)
end

#styler=(styler) ⇒ Object



175
176
177
# File 'lib/ruby-latex.rb', line 175

def styler=(styler)
    @styler = styler
end