Module: HexWrench::Resource::ClassMethods

Defined in:
lib/hexwrench/core/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#features_hashObject

Returns the value of attribute features_hash.



15
16
17
# File 'lib/hexwrench/core/resource.rb', line 15

def features_hash
  @features_hash
end

Instance Method Details

#feature(name, type = nil) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/hexwrench/core/resource.rb', line 16

def feature(name, type=nil)
  if type
    f = Feature.for(name, self, type)
    yield f if block_given?
    features_hash[name] = f
  end
  features_hash[name]
end

#features(persp) ⇒ Object



25
26
27
28
29
# File 'lib/hexwrench/core/resource.rb', line 25

def features(persp)
  perspective(persp).fields.map do |f|
    feature(f)
  end
end