Module: UState::Query::Narity
Instance Method Summary collapse
- #==(o) ⇒ Object
- #as ⇒ Object
- #as=(as) ⇒ Object
- #children ⇒ Object
- #children=(c) ⇒ Object
- #initialize(*as) ⇒ Object
- #inspect ⇒ Object
- #mass ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#==(o) ⇒ Object
6 7 8 9 |
# File 'lib/ustate/query/narity.rb', line 6 def ==(o) self.class == o.class and a == o.a end |
#as ⇒ Object
11 12 13 |
# File 'lib/ustate/query/narity.rb', line 11 def as @as end |
#as=(as) ⇒ Object
15 16 17 |
# File 'lib/ustate/query/narity.rb', line 15 def as=(as) @as = as.to_set end |
#children ⇒ Object
19 20 21 |
# File 'lib/ustate/query/narity.rb', line 19 def children @as end |
#children=(c) ⇒ Object
23 24 25 |
# File 'lib/ustate/query/narity.rb', line 23 def children=(c) @as = c.to_set end |
#initialize(*as) ⇒ Object
2 3 4 |
# File 'lib/ustate/query/narity.rb', line 2 def initialize(*as) @as = as.to_set end |
#inspect ⇒ Object
27 28 29 |
# File 'lib/ustate/query/narity.rb', line 27 def inspect inspect_helper *@as end |
#mass ⇒ Object
31 32 33 34 35 |
# File 'lib/ustate/query/narity.rb', line 31 def mass @as.inject(1) do |sum, a| sum + (a.mass rescue 1) end end |
#to_s ⇒ Object
37 38 39 40 41 |
# File 'lib/ustate/query/narity.rb', line 37 def to_s "(" + @as.map do |a| a.to_s end.join(" #{self.class.to_s.split("::").last.downcase} ") + ")" end |