Class: BenchmarkToJs::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/benchmark_to_js/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



5
6
7
8
9
10
# File 'lib/benchmark_to_js/configuration.rb', line 5

def initialize
  self.run_in_environments = [:development]
  self.pretty = true
  self.orange_threshold = 100
  self.red_threshold = 500
end

Instance Attribute Details

#orange_thresholdObject

Returns the value of attribute orange_threshold.



3
4
5
# File 'lib/benchmark_to_js/configuration.rb', line 3

def orange_threshold
  @orange_threshold
end

#prettyObject

Returns the value of attribute pretty.



3
4
5
# File 'lib/benchmark_to_js/configuration.rb', line 3

def pretty
  @pretty
end

#red_thresholdObject

Returns the value of attribute red_threshold.



3
4
5
# File 'lib/benchmark_to_js/configuration.rb', line 3

def red_threshold
  @red_threshold
end

#run_in_environmentsObject

Returns the value of attribute run_in_environments.



3
4
5
# File 'lib/benchmark_to_js/configuration.rb', line 3

def run_in_environments
  @run_in_environments
end

Instance Method Details

#run?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/benchmark_to_js/configuration.rb', line 12

def run?
  @run ||= begin
    defined?(Rails) && Array(self.run_in_environments).map(&:to_s).include?(Rails.env)
  end
end