Class: GreenLog::Entry::Builder
- Inherits:
-
Object
- Object
- GreenLog::Entry::Builder
- Defined in:
- lib/green_log/entry.rb
Overview
A builder for entries.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#message ⇒ Object
Returns the value of attribute message.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
- #build(*args, &block) ⇒ Object
-
#initialize(severity) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(severity) ⇒ Builder
Returns a new instance of Builder.
40 41 42 |
# File 'lib/green_log/entry.rb', line 40 def initialize(severity) @severity = severity end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
46 47 48 |
# File 'lib/green_log/entry.rb', line 46 def data @data end |
#exception ⇒ Object
Returns the value of attribute exception.
47 48 49 |
# File 'lib/green_log/entry.rb', line 47 def exception @exception end |
#message ⇒ Object
Returns the value of attribute message.
45 46 47 |
# File 'lib/green_log/entry.rb', line 45 def @message end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
44 45 46 |
# File 'lib/green_log/entry.rb', line 44 def severity @severity end |
Instance Method Details
#build(*args, &block) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/green_log/entry.rb', line 67 def build(*args, &block) args.each(&method(:handle_arg)) if block if block.arity.zero? Array(block.call).each(&method(:handle_arg)) else block.call(self) end end Entry.with(severity: severity, message: , data: data, exception: exception) end |