Sha256: 3a97535af693ac2b75ac6ca03e020d7488b6bed1579453e0b252eb0a056a1c34

Contents?: true

Size: 985 Bytes

Versions: 2

Compression:

Stored size: 985 Bytes

Contents

module ReactOnRails
  def self.configure
    yield(configuration)
  end

  def self.configuration
    @configuration ||= Configuration.new(
      server_bundle_js_file: "app/assets/javascripts/generated/server.js",
      prerender: false,
      replay_console: true,
      generator_function: false,
      trace: Rails.env.development?
    )
  end

  class Configuration
    attr_accessor :server_bundle_js_file, :prerender, :replay_console, :generator_function, :trace

    def initialize(server_bundle_js_file: nil, prerender: nil, replay_console: nil,
                   generator_function: nil, trace: nil)
      if File.exist?(server_bundle_js_file)
        self.server_bundle_js_file = server_bundle_js_file
      else
        self.server_bundle_js_file = nil
      end

      self.prerender = prerender
      self.replay_console = replay_console
      self.generator_function = generator_function
      self.trace = trace.nil? ? Rails.env.development? : trace
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
react_on_rails-0.1.4 lib/react_on_rails/configuration.rb
react_on_rails-0.1.3 lib/react_on_rails/configuration.rb