Class: Strike::Table
- Inherits:
-
Object
show all
- Defined in:
- lib/strike/table.rb
Instance Method Summary
collapse
Constructor Details
#initialize {|_self| ... } ⇒ Table
Returns a new instance of Table.
5
6
7
8
|
# File 'lib/strike/table.rb', line 5
def initialize(&block)
@definition ||= {}
yield self if block_given?
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
10
11
12
13
14
|
# File 'lib/strike/table.rb', line 10
def method_missing(method, *args, &block)
@definition[method] = block_given? ? yield(self) : args.first
true
end
|
Instance Method Details
#call ⇒ Object
16
17
18
|
# File 'lib/strike/table.rb', line 16
def call
to_hash
end
|
#to_hash ⇒ Object
20
21
22
|
# File 'lib/strike/table.rb', line 20
def to_hash
@definition
end
|