Class: Cassowary::Strength
Constant Summary collapse
- RequiredStrength =
new "required"
- StrongStrength =
new "strong", SymbolicWeight.new([1.0])
- MediumStrength =
new "medium", SymbolicWeight.new([0.0, 1.0])
- WeakStrength =
new "weak", SymbolicWeight.new([0.0, 0.0, 1.0])
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#symbolic_weight ⇒ Object
Returns the value of attribute symbolic_weight.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(name = nil, symbolic_weight = nil) ⇒ Strength
constructor
A new instance of Strength.
- #inspect ⇒ Object
- #required? ⇒ Boolean
Constructor Details
#initialize(name = nil, symbolic_weight = nil) ⇒ Strength
Returns a new instance of Strength.
7 8 9 10 |
# File 'lib/strength.rb', line 7 def initialize(name = nil, symbolic_weight = nil) self.name = name self.symbolic_weight = symbolic_weight end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/strength.rb', line 5 def name @name end |
#symbolic_weight ⇒ Object
Returns the value of attribute symbolic_weight.
5 6 7 |
# File 'lib/strength.rb', line 5 def symbolic_weight @symbolic_weight end |
Instance Method Details
#each ⇒ Object
20 21 22 23 24 |
# File 'lib/strength.rb', line 20 def each [RequiredStrength, StrongStrength, MediumStrength, WeakStrength].each do |str| yield str end end |
#inspect ⇒ Object
16 17 18 |
# File 'lib/strength.rb', line 16 def inspect "#{name}" end |
#required? ⇒ Boolean
12 13 14 |
# File 'lib/strength.rb', line 12 def required? self == RequiredStrength end |