Class: FuzzyRealty::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/classes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, desired, required = false) ⇒ Parameter

Returns a new instance of Parameter.



34
35
36
37
38
39
40
41
# File 'lib/classes.rb', line 34

def initialize(type,desired,required=false)
  if !Parameter.valid_types.contains(type)
    raise "Attempting to create non-existant Parameter type" 
  end
  @type     = type
  @desired  = desired
  @required = required
end

Instance Attribute Details

#desiredObject (readonly)

Returns the value of attribute desired.



33
34
35
# File 'lib/classes.rb', line 33

def desired
  @desired
end

#requiredObject (readonly)

Returns the value of attribute required.



33
34
35
# File 'lib/classes.rb', line 33

def required
  @required
end

#typeObject (readonly)

Returns the value of attribute type.



33
34
35
# File 'lib/classes.rb', line 33

def type
  @type
end

Class Method Details

.valid_typesObject

A valid type is any of the ones there is a weight for.



44
45
46
# File 'lib/classes.rb', line 44

def self.valid_types
  FuzzyRealty::WEIGHTS.each_key.to_a
end