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.
59 60 61 |
# File 'lib/green_log/entry.rb', line 59 def initialize(severity) @severity = severity end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
65 66 67 |
# File 'lib/green_log/entry.rb', line 65 def data @data end |
#exception ⇒ Object
Returns the value of attribute exception.
66 67 68 |
# File 'lib/green_log/entry.rb', line 66 def exception @exception end |
#message ⇒ Object
Returns the value of attribute message.
64 65 66 |
# File 'lib/green_log/entry.rb', line 64 def @message end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
63 64 65 |
# File 'lib/green_log/entry.rb', line 63 def severity @severity end |
Instance Method Details
#build(*args, &block) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/green_log/entry.rb', line 86 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 |