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

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

Instance Method Summary collapse

Instance Method Details

#define_schema(&proc) ⇒ Object



1482
1483
1484
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1482

def define_schema(&proc)
    @schema_define_proc = proc
end

#extended(obj) ⇒ Object



1469
1470
1471
1472
1473
1474
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1469

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



1476
1477
1478
1479
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1476

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

#with_model(&proc) ⇒ Object



1490
1491
1492
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1490

def with_model(&proc)
    @model_proc = proc
end

#with_schema(&proc) ⇒ Object



1486
1487
1488
# File 'lib/spiderfw/model/mappers/mapper.rb', line 1486

def with_schema(&proc)
    @schema_proc = proc
end