Module: RDF::RDFObjects::ObjectSet
- Defined in:
- lib/rdf/rdfobjects/object_set.rb
Instance Attribute Summary collapse
-
#predicate ⇒ Object
readonly
Returns the value of attribute predicate.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #<<(o) ⇒ Object
- #clear ⇒ Object
- #concat(ary) ⇒ Object
- #delete(o) ⇒ Object
- #delete_at(i) ⇒ Object
- #fill(*args) ⇒ Object
- #insert(index, *obj) ⇒ Object
- #pop(n = nil) ⇒ Object
- #replace(ary) ⇒ Object
-
#reverse! ⇒ Object
def push(*obj) super(obj) @subject = self self end.
- #rotate!(cnt = 1) ⇒ Object
- #set_statement(stmt) ⇒ Object
- #shift(n = nil) ⇒ Object
- #shuffle! ⇒ Object
- #sort! ⇒ Object
- #unshift(*obj) ⇒ Object
Instance Attribute Details
#predicate ⇒ Object (readonly)
Returns the value of attribute predicate.
3 4 5 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 3 def predicate @predicate end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
3 4 5 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 3 def subject @subject end |
Instance Method Details
#<<(o) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 4 def <<(o) [*o].each do |object| next unless object @subject.push(@predicate, object) end self.replace(@subject[@predicate]) end |
#clear ⇒ Object
16 17 18 19 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 16 def clear @subject[@predicate]=nil super end |
#concat(ary) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 20 def concat(ary) ary.each do |i| @subject.push(@predicate, i) end self.replace(@subject[@predicate]) end |
#delete(o) ⇒ Object
27 28 29 30 31 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 27 def delete(o) d = super(o) @subject.remove(@predicate, o) d end |
#delete_at(i) ⇒ Object
33 34 35 36 37 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 33 def delete_at(i) d = super(i) @subject.remove(@predicate, d) if d d end |
#fill(*args) ⇒ Object
39 40 41 42 43 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 39 def fill(*args) super(args) @subject[@predicate]=self @subject[@predicate] end |
#insert(index, *obj) ⇒ Object
49 50 51 52 53 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 49 def insert(index, *obj) super(index, obj) @subject[@predicate]=self self end |
#pop(n = nil) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 55 def pop(n=nil) p = super(n) [*p].each do |obj| @subject.remove(@predicate, obj) if obj end self end |
#replace(ary) ⇒ Object
44 45 46 47 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 44 def replace(ary) obj_set=@subject[@predicate]=ary super(obj_set) end |
#reverse! ⇒ Object
def push(*obj)
super(obj)
@subject[@predicate] = self
self
end
69 70 71 72 73 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 69 def reverse! super @subject[@predicate] = self self end |
#rotate!(cnt = 1) ⇒ Object
75 76 77 78 79 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 75 def rotate!(cnt=1) super(cnt) @subject[@predicate] = self self end |
#set_statement(stmt) ⇒ Object
12 13 14 15 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 12 def set_statement(stmt) @subject = stmt.subject @predicate = stmt.predicate end |
#shift(n = nil) ⇒ Object
81 82 83 84 85 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 81 def shift(n=nil) s = super(n) @subject[@predicate] = self s end |
#shuffle! ⇒ Object
87 88 89 90 91 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 87 def shuffle! super @subject[@predicate] = self self end |
#sort! ⇒ Object
93 94 95 96 97 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 93 def sort! super @subject[@predicate] = self self end |
#unshift(*obj) ⇒ Object
99 100 101 102 103 |
# File 'lib/rdf/rdfobjects/object_set.rb', line 99 def unshift(*obj) super(obj) @subject[@predicate] = self self end |