Class: ROX::ColumnDefinitions

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

Instance Method Summary collapse

Constructor Details

#initializeColumnDefinitions

Returns a new instance of ColumnDefinitions.



142
143
144
# File 'lib/rox/rox.rb', line 142

def initialize
  @definitions = Hash.new
end

Instance Method Details

#[](key) ⇒ Object



158
159
160
# File 'lib/rox/rox.rb', line 158

def [](key)
  @definitions[key]
end

#columns(typedef, &block) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
# File 'lib/rox/rox.rb', line 146

def columns(typedef, &block)
  name = typedef
  ancestors = Array.new
  if(typedef.kind_of?(Hash))
    name = typedef.keys.first
    ancestors = [*typedef[name]].map{|ancestor| self[ancestor]}
  end
  column_list = ColumnList.new(ancestors)
  column_list.instance_eval(&block)
  @definitions[name] = column_list
end