Module: HALDecorator::Policy::DSL::ClassMethods

Defined in:
lib/hal_decorator/policy/dsl.rb

Instance Method Summary collapse

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 embed(*names)
  b = block_given? ? Proc.new : Proc.new { true }
  names.each { |name| rules.add_embed(name, b) }
end


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

#rulesObject



74
75
76
# File 'lib/hal_decorator/policy/dsl.rb', line 74

def rules
  @rules ||= Rules.new
end