Module: HALDecorator::Policy::DSL

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

Defined Under Namespace

Modules: ClassMethods Classes: Rules

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



80
81
82
# File 'lib/hal_decorator/policy/dsl.rb', line 80

def self.included(mod)
  mod.extend(ClassMethods)
end

Instance Method Details

#attribute?(name) ⇒ Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/hal_decorator/policy/dsl.rb', line 89

def attribute?(name)
  run self.class.rules.attribute_rule_for(name)
end

#embed?(name) ⇒ Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/hal_decorator/policy/dsl.rb', line 97

def embed?(name)
  run self.class.rules.embed_rule_for(name)
end

#initialize(current_user = nil, resource) ⇒ Object



84
85
86
87
# File 'lib/hal_decorator/policy/dsl.rb', line 84

def initialize(current_user = nil, resource)
  @current_user = current_user
  @resource = resource
end

#link?(rel) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/hal_decorator/policy/dsl.rb', line 93

def link?(rel)
  run self.class.rules.link_rule_for(rel)
end