Module: HALPresenter::Policy::DSL::ClassMethods
- Defined in:
- lib/hal_presenter/policy/dsl.rb
Instance Method Summary collapse
- #allow_by_default(*types) ⇒ Object
- #attribute(*names, &block) ⇒ Object
- #embed(*names, &block) ⇒ Object
- #link(*rels, &block) ⇒ Object
- #rules ⇒ Object
Instance Method Details
#allow_by_default(*types) ⇒ Object
59 60 61 |
# File 'lib/hal_presenter/policy/dsl.rb', line 59 def allow_by_default(*types) rules.defaults(*types, value: true) end |
#attribute(*names, &block) ⇒ Object
63 64 65 66 |
# File 'lib/hal_presenter/policy/dsl.rb', line 63 def attribute(*names, &block) block ||= Proc.new { true } names.each { |name| rules.add_attribute(name, block) } end |
#embed(*names, &block) ⇒ Object
73 74 75 76 |
# File 'lib/hal_presenter/policy/dsl.rb', line 73 def (*names, &block) block ||= Proc.new { true } names.each { |name| rules.(name, block) } end |
#link(*rels, &block) ⇒ Object
68 69 70 71 |
# File 'lib/hal_presenter/policy/dsl.rb', line 68 def link(*rels, &block) block ||= Proc.new { true } rels.each { |rel| rules.add_link(rel, block) } end |