Module: Halogen::Resource::ClassMethods

Defined in:
lib/halogen/resource.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#define_resource(name) ⇒ Module


26
27
28
29
30
# File 'lib/halogen/resource.rb', line 26

def define_resource(name)
  self.resource_name = name.to_s

  alias_method name, :resource
end

#property(name, options = {}, &procedure) ⇒ Object

Override standard property definition for resource-based representers


37
38
39
40
41
42
43
# File 'lib/halogen/resource.rb', line 37

def property(name, options = {}, &procedure)
  super.tap do |definition|
    unless definition.procedure || definition.options.key?(:value)
      definition.procedure = proc { resource.send(name) }
    end
  end
end