Module: DirModel::Export

Extended by:
ActiveSupport::Concern
Defined in:
lib/dir_model/export.rb,
lib/dir_model/export/files.rb,
lib/dir_model/export/aggregate_dir.rb

Defined Under Namespace

Modules: Files Classes: AggregateDir

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



11
12
13
# File 'lib/dir_model/export.rb', line 11

def context
  @context
end

#source_modelObject (readonly)

Returns the value of attribute source_model.



11
12
13
# File 'lib/dir_model/export.rb', line 11

def source_model
  @source_model
end

Instance Method Details

#initialize(source_model, context = {}) ⇒ Object

Parameters:

  • source_model (Model)

    object to export to files

  • context (Hash) (defaults to: {})


15
16
17
18
19
# File 'lib/dir_model/export.rb', line 15

def initialize(source_model, context={})
  @source_model = source_model
  @context      = OpenStruct.new(context)
  @root_path    = Dir.mktmpdir
end

#pathObject



21
22
23
24
# File 'lib/dir_model/export.rb', line 21

def path
  generate unless generated?
  @root_path
end