Sha256: 7bfda2b4c0ff7f4ee9fa3ef136eed92ded7b96e08f7af5e9932df57433aae0d8
Contents?: true
Size: 1.35 KB
Versions: 8
Compression:
Stored size: 1.35 KB
Contents
require 'spiderfw/model/mappers/hash_mapper' module Spider; module Model # BaseModel having its data defined in the class. # The data must be an array of hashes, and will be handled by the Mappers::HashMapper. class InlineModel < BaseModel class <<self # Sets model data. def data=(val) @data = val end # Sets/gets model data. def data(val=nil) self.data = val if (val) d = @data if self.translate? Spider::GetText.in_domain(self.app.short_name){ @data.each do |k, v| d[k] = _(v) end } end d end def translate=(val) @translate = val end def translate? @translate end def mapper return Mappers::HashMapper.new(self, self.data) end def get_storage(url='default') self.data end end def mapper return self.class.mapper end end end; end
Version data entries
8 entries across 8 versions & 1 rubygems