Class: Vigia::Adapter::Structure
- Inherits:
-
Object
- Object
- Vigia::Adapter::Structure
- Defined in:
- lib/vigia/adapter.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#contexts ⇒ Object
readonly
Returns the value of attribute contexts.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Class Method Summary collapse
Instance Method Summary collapse
- #after_initialize(&block) ⇒ Object
- #context(name, options = {}) ⇒ Object
- #group(name, options = {}) ⇒ Object
-
#initialize(adapter, template) ⇒ Structure
constructor
A new instance of Structure.
- #preload ⇒ Object
Constructor Details
#initialize(adapter, template) ⇒ Structure
Returns a new instance of Structure.
44 45 46 47 48 49 |
# File 'lib/vigia/adapter.rb', line 44 def initialize(adapter, template) @adapter = adapter @template = template @groups = {} @contexts = {} end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
42 43 44 |
# File 'lib/vigia/adapter.rb', line 42 def adapter @adapter end |
#contexts ⇒ Object (readonly)
Returns the value of attribute contexts.
42 43 44 |
# File 'lib/vigia/adapter.rb', line 42 def contexts @contexts end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
42 43 44 |
# File 'lib/vigia/adapter.rb', line 42 def groups @groups end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
42 43 44 |
# File 'lib/vigia/adapter.rb', line 42 def template @template end |
Class Method Details
.generate(adapter, structure) ⇒ Object
35 36 37 38 39 |
# File 'lib/vigia/adapter.rb', line 35 def generate(adapter, structure) instance = new(adapter, structure) instance.preload instance end |
Instance Method Details
#after_initialize(&block) ⇒ Object
58 59 60 |
# File 'lib/vigia/adapter.rb', line 58 def after_initialize(&block) adapter.instance_exec(&block) end |
#context(name, options = {}) ⇒ Object
66 67 68 |
# File 'lib/vigia/adapter.rb', line 66 def context(name, = {}) @contexts.merge!(name => ) end |
#group(name, options = {}) ⇒ Object
62 63 64 |
# File 'lib/vigia/adapter.rb', line 62 def group(name, = {}) @groups.merge!(name => ) end |