Class: OntologyUnited::DSL::PseudoSet
- Inherits:
-
Array
- Object
- Array
- OntologyUnited::DSL::PseudoSet
- Defined in:
- lib/ontology-united/dsl/pseudo_set.rb
Instance Method Summary collapse
- #+(arr) ⇒ Object
- #<<(obj) ⇒ Object
- #add_or_fetch(obj) ⇒ Object
- #array_concat ⇒ Object
- #array_push ⇒ Object
- #concat(arr) ⇒ Object
- #push(obj) ⇒ Object
Instance Method Details
#+(arr) ⇒ Object
31 32 33 |
# File 'lib/ontology-united/dsl/pseudo_set.rb', line 31 def +(arr) concat(arr) end |
#<<(obj) ⇒ Object
21 22 23 |
# File 'lib/ontology-united/dsl/pseudo_set.rb', line 21 def <<(obj) push(obj) end |
#add_or_fetch(obj) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/ontology-united/dsl/pseudo_set.rb', line 8 def add_or_fetch(obj) if include?(obj) at(index(obj)) else array_push(obj) obj end end |
#array_concat ⇒ Object
6 |
# File 'lib/ontology-united/dsl/pseudo_set.rb', line 6 alias_method :array_concat, :concat |
#array_push ⇒ Object
5 |
# File 'lib/ontology-united/dsl/pseudo_set.rb', line 5 alias_method :array_push, :push |
#concat(arr) ⇒ Object
25 26 27 28 29 |
# File 'lib/ontology-united/dsl/pseudo_set.rb', line 25 def concat(arr) array = dup arr.each { |el| array.push(el) } array end |
#push(obj) ⇒ Object
17 18 19 |
# File 'lib/ontology-united/dsl/pseudo_set.rb', line 17 def push(obj) include?(obj) ? self : array_push(obj) end |