Module: HALPresenter::Policy::DSL::ClassMethods
- Defined in:
- lib/hal_presenter/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
61 62 63 |
# File 'lib/hal_presenter/policy/dsl.rb', line 61 def allow_by_default(*types) rules.defaults(*types, value: true) end |
#attribute(*names) ⇒ Object
65 66 67 68 |
# File 'lib/hal_presenter/policy/dsl.rb', line 65 def attribute(*names) b = block_given? ? Proc.new : Proc.new { true } names.each { |name| rules.add_attribute(name, b) } end |
#embed(*names) ⇒ Object
75 76 77 78 |
# File 'lib/hal_presenter/policy/dsl.rb', line 75 def (*names) b = block_given? ? Proc.new : Proc.new { true } names.each { |name| rules.(name, b) } end |
#link(*rels) ⇒ Object
70 71 72 73 |
# File 'lib/hal_presenter/policy/dsl.rb', line 70 def link(*rels) b = block_given? ? Proc.new : Proc.new { true } rels.each { |rel| rules.add_link(rel, b) } end |