Class: Janko::Flag
- Inherits:
-
Object
- Object
- Janko::Flag
- Defined in:
- lib/janko/flag.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #===(other) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(value) ⇒ Flag
constructor
A new instance of Flag.
- #|(other) ⇒ Object
Constructor Details
#initialize(value) ⇒ Flag
Returns a new instance of Flag.
5 6 7 |
# File 'lib/janko/flag.rb', line 5 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/janko/flag.rb', line 3 def value @value end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 |
# File 'lib/janko/flag.rb', line 18 def ==(other) eql?(other) end |
#===(other) ⇒ Object
22 23 24 |
# File 'lib/janko/flag.rb', line 22 def ===(other) eql?(other) end |
#eql?(other) ⇒ Boolean
13 14 15 16 |
# File 'lib/janko/flag.rb', line 13 def eql?(other) return unless other.is_a?(self.class) (value & other.value) != 0 end |
#|(other) ⇒ Object
9 10 11 |
# File 'lib/janko/flag.rb', line 9 def |(other) self.class.new(value | other.value) end |