Class: React::Rails::AssetVariant

Inherits:
Object
  • Object
show all
Defined in:
lib/react/rails/asset_variant.rb

Constant Summary collapse

GEM_ROOT =
Pathname.new('../../../../').expand_path(__FILE__)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AssetVariant

Returns a new instance of AssetVariant.



7
8
9
10
11
12
13
14
15
16
# File 'lib/react/rails/asset_variant.rb', line 7

def initialize(options={})
  # We want to include different files in dev/prod. The development builds
  # contain console logging for invariants and logging to help catch
  # common mistakes. These are all stripped out in the production build.
  @react_build = options[:variant] == :production ? 'production' : 'development'
  options[:addons] && @react_build += '-with-addons'

  @react_directory = GEM_ROOT.join('lib/assets/react-source/').join(@react_build).to_s
  @jsx_directory =   GEM_ROOT.join('lib/assets/javascripts/').to_s
end

Instance Attribute Details

#jsx_directoryObject (readonly)

Returns the value of attribute jsx_directory.



5
6
7
# File 'lib/react/rails/asset_variant.rb', line 5

def jsx_directory
  @jsx_directory
end

#react_buildObject (readonly)

Returns the value of attribute react_build.



5
6
7
# File 'lib/react/rails/asset_variant.rb', line 5

def react_build
  @react_build
end

#react_directoryObject (readonly)

Returns the value of attribute react_directory.



5
6
7
# File 'lib/react/rails/asset_variant.rb', line 5

def react_directory
  @react_directory
end