Module: DataMapper::YS::Proxy::ClassMethods
- Defined in:
- lib/dm-ys/proxy.rb
Instance Method Summary collapse
- #all ⇒ Object
- #count ⇒ Object
- #first ⇒ Object
- #get(*ids) ⇒ Object
- #labels ⇒ Object
- #last ⇒ Object
- #names ⇒ Object
- #proxy ⇒ Object
- #records ⇒ Object
Instance Method Details
#all ⇒ Object
49 50 51 |
# File 'lib/dm-ys/proxy.rb', line 49 def all records end |
#count ⇒ Object
45 46 47 |
# File 'lib/dm-ys/proxy.rb', line 45 def count records.size end |
#first ⇒ Object
53 54 55 |
# File 'lib/dm-ys/proxy.rb', line 53 def first all.first end |
#get(*ids) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/dm-ys/proxy.rb', line 61 def get(*ids) if ids.size == 1 and !ids.first.is_a?(Array) all[ids.to_i] else ids.map{|id| get(id)} end end |
#labels ⇒ Object
37 38 39 |
# File 'lib/dm-ys/proxy.rb', line 37 def labels proxy.labels end |
#last ⇒ Object
57 58 59 |
# File 'lib/dm-ys/proxy.rb', line 57 def last all.last end |
#names ⇒ Object
33 34 35 |
# File 'lib/dm-ys/proxy.rb', line 33 def names proxy.names end |
#proxy ⇒ Object
29 30 31 |
# File 'lib/dm-ys/proxy.rb', line 29 def proxy @proxy ||= Scraper.load(self) end |
#records ⇒ Object
41 42 43 |
# File 'lib/dm-ys/proxy.rb', line 41 def records @records ||= (proxy.records.each_with_index{|r,i| r.id = i+1}; proxy.records) end |