Module: HALDecorator::Policy::DSL::ClassMethods
- Defined in:
- lib/hal_decorator/policy/dsl.rb
Instance Method Summary collapse
- #allow_by_default(*types) ⇒ Object
- #attribute(*names) ⇒ Object
- #embed(*names) ⇒ Object
- #link(*rels) ⇒ Object
- #rules ⇒ Object
Instance Method Details
#allow_by_default(*types) ⇒ Object
55 56 57 |
# File 'lib/hal_decorator/policy/dsl.rb', line 55 def allow_by_default(*types) rules.defaults(*types, value: true) end |
#attribute(*names) ⇒ Object
59 60 61 62 |
# File 'lib/hal_decorator/policy/dsl.rb', line 59 def attribute(*names) b = block_given? ? Proc.new : Proc.new { true } names.each { |name| rules.add_attribute(name, b) } end |
#embed(*names) ⇒ Object
69 70 71 72 |
# File 'lib/hal_decorator/policy/dsl.rb', line 69 def (*names) b = block_given? ? Proc.new : Proc.new { true } names.each { |name| rules.(name, b) } end |
#link(*rels) ⇒ Object
64 65 66 67 |
# File 'lib/hal_decorator/policy/dsl.rb', line 64 def link(*rels) b = block_given? ? Proc.new : Proc.new { true } rels.each { |rel| rules.add_link(rel, b) } end |