Class: ROM::Plugins::Relation::View::DSL
- Inherits:
-
Object
- Object
- ROM::Plugins::Relation::View::DSL
- Defined in:
- lib/rom/plugins/relation/view/dsl.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#relation_block ⇒ Object
readonly
Returns the value of attribute relation_block.
Instance Method Summary collapse
- #call ⇒ Object
- #header(*args, &block) ⇒ Object
-
#initialize(name, &block) ⇒ DSL
constructor
A new instance of DSL.
- #relation(&block) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ DSL
Returns a new instance of DSL.
12 13 14 15 |
# File 'lib/rom/plugins/relation/view/dsl.rb', line 12 def initialize(name, &block) @name = name instance_eval(&block) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
8 9 10 |
# File 'lib/rom/plugins/relation/view/dsl.rb', line 8 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/rom/plugins/relation/view/dsl.rb', line 6 def name @name end |
#relation_block ⇒ Object (readonly)
Returns the value of attribute relation_block.
10 11 12 |
# File 'lib/rom/plugins/relation/view/dsl.rb', line 10 def relation_block @relation_block end |
Instance Method Details
#call ⇒ Object
25 26 27 |
# File 'lib/rom/plugins/relation/view/dsl.rb', line 25 def call [name, attributes, relation_block] end |
#header(*args, &block) ⇒ Object
17 18 19 |
# File 'lib/rom/plugins/relation/view/dsl.rb', line 17 def header(*args, &block) @attributes = args.size > 0 ? args.first : block end |
#relation(&block) ⇒ Object
21 22 23 |
# File 'lib/rom/plugins/relation/view/dsl.rb', line 21 def relation(&block) @relation_block = lambda(&block) end |