Class: Catlogic::Distribution
- Inherits:
-
Object
- Object
- Catlogic::Distribution
- Defined in:
- lib/catlogic/distribution.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
-
#initialize(distribution) ⇒ Distribution
constructor
A new instance of Distribution.
- #opposite ⇒ Object
Constructor Details
#initialize(distribution) ⇒ Distribution
Returns a new instance of Distribution.
5 6 7 |
# File 'lib/catlogic/distribution.rb', line 5 def initialize(distribution) @label = distribution end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
3 4 5 |
# File 'lib/catlogic/distribution.rb', line 3 def label @label end |
Instance Method Details
#opposite ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/catlogic/distribution.rb', line 9 def opposite if self.label == 'distributed' opposite = Distribution.new('undistributed') elsif self.label == 'undistributed' opposite = Distribution.new('distributed') end return opposite end |