Class: Tabl::Definition
- Inherits:
-
Object
- Object
- Tabl::Definition
- Defined in:
- lib/tabl/definition.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#default_format ⇒ Object
Returns the value of attribute default_format.
-
#default_value ⇒ Object
Returns the value of attribute default_value.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #clone ⇒ Object
- #configure {|_self| ... } ⇒ Object
-
#initialize(values_override = nil, &block) ⇒ Definition
constructor
A new instance of Definition.
Constructor Details
#initialize(values_override = nil, &block) ⇒ Definition
Returns a new instance of Definition.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tabl/definition.rb', line 11 def initialize(values_override = nil, &block) @columns = [] @labels = {} @values = {} @format = {} @values_override = values_override @default_format = lambda { |v| v } @default_value = nil configure(&block) format = Hash.new { Format.new } end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
3 4 5 |
# File 'lib/tabl/definition.rb', line 3 def columns @columns end |
#default_format ⇒ Object
Returns the value of attribute default_format.
8 9 10 |
# File 'lib/tabl/definition.rb', line 8 def default_format @default_format end |
#default_value ⇒ Object
Returns the value of attribute default_value.
9 10 11 |
# File 'lib/tabl/definition.rb', line 9 def default_value @default_value end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
7 8 9 |
# File 'lib/tabl/definition.rb', line 7 def format @format end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
4 5 6 |
# File 'lib/tabl/definition.rb', line 4 def labels @labels end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
5 6 7 |
# File 'lib/tabl/definition.rb', line 5 def values @values end |
Instance Method Details
#clone ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/tabl/definition.rb', line 35 def clone other = super other.instance_variable_set(:@columns, @columns.clone) other.instance_variable_set(:@labels, @labels.clone) other.instance_variable_set(:@values, @values.clone) other.instance_variable_set(:@format, @format.clone) other end |
#configure {|_self| ... } ⇒ Object
23 24 25 |
# File 'lib/tabl/definition.rb', line 23 def configure(&block) yield(self) if block_given? end |