Module: DataMapper::YS

Defined in:
lib/dm-ys/base.rb,
lib/dm-ys/proxy.rb,
lib/dm-ys/config.rb,
lib/dm-ys/scraper.rb,
lib/dm-ys/cached_accessor.rb,
lib/dm-ys/element_property.rb,
lib/dm-ys/indexed_property.rb,
lib/dm-ys/memory_repository.rb

Defined Under Namespace

Modules: CachedAccessor, ElementProperty, IndexedProperty, MemoryRepository, Proxy, Scraper Classes: Config, InvalidIndex

Class Method Summary collapse

Class Method Details

.[](uri) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/dm-ys/base.rb', line 32

def self.[](uri)
  klass = Class.new
  klass.class_eval do
    include DataMapper::YS
    self.uri uri
  end
  return klass
end

.append_inclusions(*inclusions) ⇒ Object



4
5
6
7
# File 'lib/dm-ys/base.rb', line 4

def self.append_inclusions(*inclusions)
  extra_inclusions.concat inclusions
  true
end

.descendantsObject



27
28
29
# File 'lib/dm-ys/base.rb', line 27

def self.descendants
  @descendants ||= Set.new
end

.extra_inclusionsObject



9
10
11
# File 'lib/dm-ys/base.rb', line 9

def self.extra_inclusions
  @extra_inclusions ||= []
end

.included(model) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dm-ys/base.rb', line 14

def self.included(model)
  name = 'YS'
  model.send :include, DataMapper::Resource
  model.send :include, Proxy
  model.send :include, IndexedProperty
  model.send :include, ElementProperty
  # model.send :include, MemoryRepository
  model.const_set(name, self) unless model.const_defined?(name)
  extra_inclusions.each { |inclusion| model.send(:include, inclusion) }
  descendants << model
end