Class: Alephant::Writer
- Inherits:
-
Object
- Object
- Alephant::Writer
- Defined in:
- lib/alephant/models/writer.rb
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#mapper ⇒ Object
readonly
Returns the value of attribute mapper.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Writer
constructor
A new instance of Writer.
- #write(data, version = nil) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Writer
Returns a new instance of Writer.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/alephant/models/writer.rb', line 7 def initialize(opts) @renderer_id = opts[:renderer_id] @cache = Cache.new( opts[:s3_bucket_id], opts[:s3_object_path] ) @mapper = RenderMapper.new( opts[:renderer_id], opts[:view_path] ) @lookup_table_name = opts[:lookup_table_name] end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
5 6 7 |
# File 'lib/alephant/models/writer.rb', line 5 def cache @cache end |
#mapper ⇒ Object (readonly)
Returns the value of attribute mapper.
5 6 7 |
# File 'lib/alephant/models/writer.rb', line 5 def mapper @mapper end |
Instance Method Details
#write(data, version = nil) ⇒ Object
22 23 24 25 26 |
# File 'lib/alephant/models/writer.rb', line 22 def write(data, version = nil) mapper.generate(data).each do |id, r| store(id, r.render, data[:options], version) end end |