Class: ActiveRecordSegment::Configuration
- Inherits:
-
Object
- Object
- ActiveRecordSegment::Configuration
- Defined in:
- lib/active_record_segment.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#env ⇒ Object
Returns the value of attribute env.
-
#ignored_attributes ⇒ Object
Returns the value of attribute ignored_attributes.
-
#ignored_klasses ⇒ Object
Returns the value of attribute ignored_klasses.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#segment_write_key ⇒ Object
Returns the value of attribute segment_write_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #segment_analytic ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
16 17 18 19 20 21 22 23 |
# File 'lib/active_record_segment.rb', line 16 def initialize # Set default value if user forget to configure self.ignored_attributes = DEFAULT_IGNORED_ATTRIBUTES self.ignored_klasses = [] self.enabled = false self.env = defined?(Rails) && Rails.env.to_s self.logger = Logger.new(STDOUT) end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
14 15 16 |
# File 'lib/active_record_segment.rb', line 14 def enabled @enabled end |
#env ⇒ Object
Returns the value of attribute env.
14 15 16 |
# File 'lib/active_record_segment.rb', line 14 def env @env end |
#ignored_attributes ⇒ Object
Returns the value of attribute ignored_attributes.
14 15 16 |
# File 'lib/active_record_segment.rb', line 14 def ignored_attributes @ignored_attributes end |
#ignored_klasses ⇒ Object
Returns the value of attribute ignored_klasses.
14 15 16 |
# File 'lib/active_record_segment.rb', line 14 def ignored_klasses @ignored_klasses end |
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/active_record_segment.rb', line 14 def logger @logger end |
#segment_write_key ⇒ Object
Returns the value of attribute segment_write_key.
14 15 16 |
# File 'lib/active_record_segment.rb', line 14 def segment_write_key @segment_write_key end |
Instance Method Details
#segment_analytic ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_record_segment.rb', line 25 def segment_analytic if segment_write_key.nil? raise StandardError.new("Please config segment write key before call this method") end @segment_analytic ||= Segment::Analytics.new( write_key: segment_write_key, on_error: proc { |status, msg| print msg } ) end |