Module: TPhases::Config::ClassMethods

Defined in:
lib/tphases/config.rb

Instance Method Summary collapse

Instance Method Details

#configObject

the config settings options are:

  • mode

  • collect_mode_failures_on - defaults to true, but can be turned off temporarily to disable failures on

    transaction violations
    

sets default value ‘mode` value based on presence of Rails and environment type the default setting is the safest, :pass_through, which means TPhases does nothing.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tphases/config.rb', line 21

def config
  @config ||= begin

    default_mode = begin
      if defined? ::Rails
        case ::Rails.env
          when 'production', 'staging', 'demo'
            :pass_through
          when 'development'
            :exceptions
          when 'test'
            :collect
          else
            :pass_through
        end
      else
        :pass_through
      end
    end

    Struct.new(:mode, :collect_mode_failures_on).new(default_mode, true)
  end
end

#configure {|config| ... } ⇒ Object

allow for configuration of TPhases

Yields:



7
8
9
# File 'lib/tphases/config.rb', line 7

def configure(&block)
  yield config
end