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(name) ⇒ Object



59
60
61
62
# File 'lib/hal_decorator/policy/dsl.rb', line 59

def attribute(name)
  b = block_given? ? Proc.new : Proc.new { true }
  rules.add_attribute(name, b)
end

#embed(name) ⇒ Object



69
70
71
72
# File 'lib/hal_decorator/policy/dsl.rb', line 69

def embed(name)
  b = block_given? ? Proc.new : Proc.new { true }
  rules.add_embed(name, b)
end


64
65
66
67
# File 'lib/hal_decorator/policy/dsl.rb', line 64

def link(rel)
  b = block_given? ? Proc.new : Proc.new { true }
  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