Class: HexWrench::Feature
- Inherits:
-
Object
- Object
- HexWrench::Feature
- Defined in:
- lib/hexwrench/core/feature.rb
Direct Known Subclasses
DateFeature, NominalFeature, NumericFeature, RelationFeature, StringFeature
Instance Attribute Summary collapse
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#sym ⇒ Object
Returns the value of attribute sym.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(sym, resource) ⇒ Feature
constructor
A new instance of Feature.
Constructor Details
#initialize(sym, resource) ⇒ Feature
Returns a new instance of Feature.
21 22 23 24 |
# File 'lib/hexwrench/core/feature.rb', line 21 def initialize(sym, resource) @resource = resource @sym = sym end |
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
19 20 21 |
# File 'lib/hexwrench/core/feature.rb', line 19 def resource @resource end |
#sym ⇒ Object
Returns the value of attribute sym.
19 20 21 |
# File 'lib/hexwrench/core/feature.rb', line 19 def sym @sym end |
Class Method Details
.for(sym, resource, type) ⇒ Object
13 14 15 16 17 |
# File 'lib/hexwrench/core/feature.rb', line 13 def self.for(sym, resource, type) raise ArgumentError.new, "not understood type: #{type}" unless mapping.has_key?(type) klass = mapping[type] klass.new(sym, resource) end |
.mapping ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/hexwrench/core/feature.rb', line 4 def self.mapping {:numeric => NumericFeature, :date => DateFeature, :nominal => NominalFeature, :string => StringFeature, :related => RelationFeature } end |