Module: UState::Query::Binarity
- Included in:
- Approximately, Equals, Greater, GreaterEqual, Less, LessEqual, NotEquals
- Defined in:
- lib/ustate/query/binarity.rb
Instance Method Summary collapse
- #==(o) ⇒ Object
- #a ⇒ Object
- #b ⇒ Object
- #children ⇒ Object
- #children=(c) ⇒ Object
- #initialize(a, b) ⇒ Object
- #inspect ⇒ Object
- #mass ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#==(o) ⇒ Object
7 8 9 10 11 |
# File 'lib/ustate/query/binarity.rb', line 7 def ==(o) self.class == o.class and a == o.a and b == o.b end |
#a ⇒ Object
13 14 15 |
# File 'lib/ustate/query/binarity.rb', line 13 def a @a end |
#b ⇒ Object
17 18 19 |
# File 'lib/ustate/query/binarity.rb', line 17 def b @b end |
#children ⇒ Object
21 22 23 |
# File 'lib/ustate/query/binarity.rb', line 21 def children [@a, @b] end |
#children=(c) ⇒ Object
25 26 27 28 |
# File 'lib/ustate/query/binarity.rb', line 25 def children=(c) raise ArgumentError unless c.size == 2 @a, @b = c end |
#initialize(a, b) ⇒ Object
2 3 4 5 |
# File 'lib/ustate/query/binarity.rb', line 2 def initialize(a, b) @a = a @b = b end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/ustate/query/binarity.rb', line 30 def inspect inspect_helper @a, @b end |
#mass ⇒ Object
34 35 36 |
# File 'lib/ustate/query/binarity.rb', line 34 def mass 1 + (@a.mass rescue 1) + (@b.mass rescue 1) end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/ustate/query/binarity.rb', line 38 def to_s "(#{@a} #{self.class.to_s.split('::').last.downcase} #{@b})" end |