Class: Fauxsql::AttributeList
- Inherits:
-
Array
- Object
- Array
- Fauxsql::AttributeList
- Defined in:
- lib/fauxsql/attribute_list.rb
Overview
AttributeList is an Array that dereferences and resolves fauxsql attributes when setting/reading members in the Array
Direct Known Subclasses
Instance Method Summary collapse
- #-(others) ⇒ Object
- #<<(attribute) ⇒ Object
- #[](index) ⇒ Object
- #all ⇒ Object
- #each ⇒ Object
- #each_with_index ⇒ Object
-
#eql?(other) ⇒ Boolean
Always being not eql is expensive TODO make this work without this hack.
- #equals(list) ⇒ Object
- #first ⇒ Object
- #last ⇒ Object
Instance Method Details
#-(others) ⇒ Object
37 38 39 40 41 |
# File 'lib/fauxsql/attribute_list.rb', line 37 def -(others) others = others.map{|other| Fauxsql.dereference_fauxsql_attribute(other).hash } reject!{|one| others.include?(one.hash) } self end |
#<<(attribute) ⇒ Object
5 6 7 |
# File 'lib/fauxsql/attribute_list.rb', line 5 def <<(attribute) super Fauxsql.dereference_fauxsql_attribute(attribute) end |
#[](index) ⇒ Object
9 10 11 |
# File 'lib/fauxsql/attribute_list.rb', line 9 def [] index Fauxsql.resolve_fauxsql_attribute super(index) end |
#all ⇒ Object
21 22 23 |
# File 'lib/fauxsql/attribute_list.rb', line 21 def all map{|item| Fauxsql.resolve_fauxsql_attribute item } end |
#each ⇒ Object
29 30 31 |
# File 'lib/fauxsql/attribute_list.rb', line 29 def each super{|item| yield(Fauxsql.resolve_fauxsql_attribute(item)) } end |
#each_with_index ⇒ Object
33 34 35 |
# File 'lib/fauxsql/attribute_list.rb', line 33 def each_with_index super{|item, index| yield(Fauxsql.resolve_fauxsql_attribute(item), index) } end |
#eql?(other) ⇒ Boolean
Always being not eql is expensive TODO make this work without this hack
45 46 47 |
# File 'lib/fauxsql/attribute_list.rb', line 45 def eql?(other) return false end |
#equals(list) ⇒ Object
25 26 27 |
# File 'lib/fauxsql/attribute_list.rb', line 25 def equals list map_resolved == list end |
#first ⇒ Object
13 14 15 |
# File 'lib/fauxsql/attribute_list.rb', line 13 def first self[0] end |
#last ⇒ Object
17 18 19 |
# File 'lib/fauxsql/attribute_list.rb', line 17 def last self[length - 1] end |