Sha256: dc6b3dc9d8ae788d4ff4f6c60ff9d440a2a0483046972c1ae64d5a3feb52163f

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

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,
      logging_on_server: true,
      generator_function: false,
      trace: Rails.env.development?,
    )
  end

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

    def initialize(server_bundle_js_file: nil, prerender: nil, replay_console: nil,
                   generator_function: nil, trace: nil, logging_on_server: 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.logging_on_server = logging_on_server
      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.6 lib/react_on_rails/configuration.rb
react_on_rails-0.1.5 lib/react_on_rails/configuration.rb