Module: Spider::Model::MapperIncludeModule::ModuleMethods

Defined in:
lib/spiderfw/model/mappers/mapper.rb

Instance Method Summary collapse

Instance Method Details

#define_schema(&proc) ⇒ Object



1453
1454
1455
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1453

def define_schema(&proc)
    @schema_define_proc = proc
end

#extended(obj) ⇒ Object



1440
1441
1442
1443
1444
1445
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1440

def extended(obj)
    obj.define_schema &@schema_define_proc if @schema_define_proc
    obj.with_schema &@schema_proc if @schema_proc
    obj.no_map(*@no_map_elements.keys) if @no_map_elements
    @model_proc.call(obj.model) if @model_proc
end

#no_map(*els) ⇒ Object



1447
1448
1449
1450
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1447

def no_map(*els)
    @no_map_elements ||= {}
    els.each{ |el| @no_map_elements[el] = true }
end

#with_model(&proc) ⇒ Object



1461
1462
1463
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1461

def with_model(&proc)
    @model_proc = proc
end

#with_schema(&proc) ⇒ Object



1457
1458
1459
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1457

def with_schema(&proc)
    @schema_proc = proc
end