Module: Kashmir::Dsl::ClassMethods
- Defined in:
- lib/kashmir/dsl.rb
Instance Method Summary collapse
- #definitions ⇒ Object
- #embed(name, representer) ⇒ Object
- #group(name, fields) ⇒ Object
- #inline(name, &inline_representer) ⇒ Object
- #prop(name) ⇒ Object
- #props(*names) ⇒ Object
Instance Method Details
#definitions ⇒ Object
35 36 37 38 |
# File 'lib/kashmir/dsl.rb', line 35 def definitions @definitions ||= [] @definitions end |
#embed(name, representer) ⇒ Object
26 27 28 |
# File 'lib/kashmir/dsl.rb', line 26 def (name, representer) group(name, representer.definitions) end |
#group(name, fields) ⇒ Object
20 21 22 23 24 |
# File 'lib/kashmir/dsl.rb', line 20 def group(name, fields) definition = Hash.new definition[name] = fields definitions << definition end |
#inline(name, &inline_representer) ⇒ Object
30 31 32 33 |
# File 'lib/kashmir/dsl.rb', line 30 def inline(name, &inline_representer) representer = Kashmir::InlineDsl.build(&inline_representer) (name, representer) end |
#prop(name) ⇒ Object
10 11 12 |
# File 'lib/kashmir/dsl.rb', line 10 def prop(name) definitions << name end |
#props(*names) ⇒ Object
14 15 16 17 18 |
# File 'lib/kashmir/dsl.rb', line 14 def props(*names) names.each do |name| prop(name) end end |