Class: HALDecorator::Policy::DSL::Rules
- Inherits:
-
Object
- Object
- HALDecorator::Policy::DSL::Rules
- Defined in:
- lib/hal_decorator/policy/dsl.rb
Instance Method Summary collapse
- #add_attribute(name, block) ⇒ Object
- #add_embed(name, block) ⇒ Object
- #add_link(rel, block) ⇒ Object
- #attribute_rule_for(name) ⇒ Object
- #defaults(*types, value: false) ⇒ Object
- #embed_rule_for(name) ⇒ Object
- #link_rule_for(rel) ⇒ Object
Instance Method Details
#add_attribute(name, block) ⇒ Object
31 32 33 |
# File 'lib/hal_decorator/policy/dsl.rb', line 31 def add_attribute(name, block) attributes[name] = block end |
#add_embed(name, block) ⇒ Object
47 48 49 |
# File 'lib/hal_decorator/policy/dsl.rb', line 47 def (name, block) [name] = block end |
#add_link(rel, block) ⇒ Object
39 40 41 |
# File 'lib/hal_decorator/policy/dsl.rb', line 39 def add_link(rel, block) links[rel] = block end |
#attribute_rule_for(name) ⇒ Object
27 28 29 |
# File 'lib/hal_decorator/policy/dsl.rb', line 27 def attribute_rule_for(name) attributes[name] end |
#defaults(*types, value: false) ⇒ Object
21 22 23 24 25 |
# File 'lib/hal_decorator/policy/dsl.rb', line 21 def defaults(*types, value: false) types.each do |t| send(t).default= Proc.new { value } end end |
#embed_rule_for(name) ⇒ Object
43 44 45 |
# File 'lib/hal_decorator/policy/dsl.rb', line 43 def (name) [name] end |
#link_rule_for(rel) ⇒ Object
35 36 37 |
# File 'lib/hal_decorator/policy/dsl.rb', line 35 def link_rule_for(rel) links[rel] end |