Class: React::Rails::AssetVariant

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

Overview

This class accepts some options for which build you want, then exposes where you can find them. In general, these paths should be added to the sprockets environment.

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


18
19
20
21
22
23
24
# File 'lib/react/rails/asset_variant.rb', line 18

def initialize(options={})

  @react_build = options[:variant] == :production ? 'production' : 'development'

  @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_directoryString (readonly)


14
15
16
# File 'lib/react/rails/asset_variant.rb', line 14

def jsx_directory
  @jsx_directory
end

#react_buildString (readonly)


8
9
10
# File 'lib/react/rails/asset_variant.rb', line 8

def react_build
  @react_build
end

#react_directoryString (readonly)


11
12
13
# File 'lib/react/rails/asset_variant.rb', line 11

def react_directory
  @react_directory
end