Class: I18nJsAssets::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n-js-assets/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, source_path, target_path, options) ⇒ Entry

Returns a new instance of Entry.



9
10
11
12
13
14
# File 'lib/i18n-js-assets/entry.rb', line 9

def initialize(app, source_path, target_path, options)
  @app = app
  @source_path = source_path
  @target_path = target_path
  @options = options
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



7
8
9
# File 'lib/i18n-js-assets/entry.rb', line 7

def app
  @app
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/i18n-js-assets/entry.rb', line 7

def options
  @options
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



7
8
9
# File 'lib/i18n-js-assets/entry.rb', line 7

def source_path
  @source_path
end

#target_pathObject (readonly)

Returns the value of attribute target_path.



7
8
9
# File 'lib/i18n-js-assets/entry.rb', line 7

def target_path
  @target_path
end

Instance Method Details

#apply!Object



16
17
18
19
20
21
22
23
# File 'lib/i18n-js-assets/entry.rb', line 16

def apply!
  each_file do |locale, interpolated_target_path|
    path = "#{interpolated_target_path}.i18njs"
    app.config.assets.generated.add(path, options) do
      source.overwrite('locales' => [locale]).dump
    end
  end
end