Class: Rose::Seedling
- Inherits:
-
Object
- Object
- Rose::Seedling
- Defined in:
- lib/rose/seedling.rb
Overview
Defines the Rose DSL
Instance Attribute Summary collapse
-
#adapter ⇒ ObjectAdapter
readonly
The adapter.
-
#alterations ⇒ Array
readonly
The alterations to be applied to the sprouted Seedling (the report).
-
#options ⇒ Hash
readonly
The options used by the adapter.
-
#root ⇒ Rose::Proxy::Root
readonly
The root proxy containing attribute finder and updater.
-
#row ⇒ Rose::Proxy::Row
readonly
The row proxy containing an array of Attributes.
Instance Method Summary collapse
- #filter { ... } ⇒ Object
-
#initialize(adapter, options = {}) ⇒ Seedling
constructor
A new instance of Seedling.
- #pivot(group_column, pivot_column, &value_block) ⇒ Object
- #roots { ... } ⇒ Object
- #rows { ... } ⇒ Object
- #sort(column_name, order = :ascending, &sort_block) ⇒ Object
- #summary(column_name) { ... } ⇒ Object
Constructor Details
#initialize(adapter, options = {}) ⇒ Seedling
Returns a new instance of Seedling.
25 26 27 28 29 |
# File 'lib/rose/seedling.rb', line 25 def initialize(adapter, ={}) @adapter = adapter @options = @alterations = @options[:alterations] = [] end |
Instance Attribute Details
#adapter ⇒ ObjectAdapter (readonly)
Returns the adapter.
13 14 15 |
# File 'lib/rose/seedling.rb', line 13 def adapter @adapter end |
#alterations ⇒ Array (readonly)
Returns the alterations to be applied to the sprouted Seedling (the report).
19 20 21 |
# File 'lib/rose/seedling.rb', line 19 def alterations @alterations end |
#options ⇒ Hash (readonly)
Returns the options used by the adapter.
16 17 18 |
# File 'lib/rose/seedling.rb', line 16 def @options end |
#root ⇒ Rose::Proxy::Root (readonly)
Returns the root proxy containing attribute finder and updater.
10 11 12 |
# File 'lib/rose/seedling.rb', line 10 def root @root end |
#row ⇒ Rose::Proxy::Row (readonly)
Returns the row proxy containing an array of Attributes.
7 8 9 |
# File 'lib/rose/seedling.rb', line 7 def row @row end |
Instance Method Details
#filter { ... } ⇒ Object
46 47 48 49 |
# File 'lib/rose/seedling.rb', line 46 def filter(&filter_block) @options[:filter] = Attribute::Filter.new(nil, nil, filter_block) @alterations << @options[:filter] end |
#pivot(group_column, pivot_column, &value_block) ⇒ Object
63 64 65 66 |
# File 'lib/rose/seedling.rb', line 63 def pivot(group_column, pivot_column, &value_block) @options[:pivot] = Attribute::Pivot.new(group_column, pivot_column, value_block) @alterations << @options[:pivot] end |
#roots { ... } ⇒ Object
69 70 71 72 73 |
# File 'lib/rose/seedling.rb', line 69 def roots(&blk) proxy = Proxy::Root.new proxy.instance_eval(&blk) @root = proxy end |
#rows { ... } ⇒ Object
32 33 34 35 36 |
# File 'lib/rose/seedling.rb', line 32 def rows(&blk) proxy = Proxy::Row.new proxy.instance_eval(&blk) @row = proxy end |