Class: WatchmonkeyCli::Checker::Result
- Inherits:
-
Object
- Object
- WatchmonkeyCli::Checker::Result
- Defined in:
- lib/watchmonkey_cli/checker.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#checker ⇒ Object
readonly
Returns the value of attribute checker.
-
#command ⇒ Object
Returns the value of attribute command.
-
#data ⇒ Object
Returns the value of attribute data.
-
#result ⇒ Object
Returns the value of attribute result.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #descriptor ⇒ Object
- #dump! ⇒ Object
-
#initialize(checker, *args) ⇒ Result
constructor
A new instance of Result.
- #messages ⇒ Object
- #str_descriptor ⇒ Object
- #str_running ⇒ Object
- #str_safe ⇒ Object
- #sync(&block) ⇒ Object
- #uniqid(additional = []) ⇒ Object
Constructor Details
#initialize(checker, *args) ⇒ Result
Returns a new instance of Result.
57 58 59 60 61 62 63 64 |
# File 'lib/watchmonkey_cli/checker.rb', line 57 def initialize checker, *args @checker = checker @args = args @mutex = Monitor.new @type = :info @tags = [] @spool = { error: [], info: [], debug: []} end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
54 55 56 |
# File 'lib/watchmonkey_cli/checker.rb', line 54 def args @args end |
#checker ⇒ Object (readonly)
Returns the value of attribute checker.
54 55 56 |
# File 'lib/watchmonkey_cli/checker.rb', line 54 def checker @checker end |
#command ⇒ Object
Returns the value of attribute command.
55 56 57 |
# File 'lib/watchmonkey_cli/checker.rb', line 55 def command @command end |
#data ⇒ Object
Returns the value of attribute data.
55 56 57 |
# File 'lib/watchmonkey_cli/checker.rb', line 55 def data @data end |
#result ⇒ Object
Returns the value of attribute result.
55 56 57 |
# File 'lib/watchmonkey_cli/checker.rb', line 55 def result @result end |
#tags ⇒ Object
Returns the value of attribute tags.
55 56 57 |
# File 'lib/watchmonkey_cli/checker.rb', line 55 def @tags end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
54 55 56 |
# File 'lib/watchmonkey_cli/checker.rb', line 54 def type @type end |
Instance Method Details
#descriptor ⇒ Object
77 78 79 |
# File 'lib/watchmonkey_cli/checker.rb', line 77 def descriptor "[#{@checker.class.checker_name} | #{args.join(" | ")}]" end |
#dump! ⇒ Object
97 98 99 100 101 102 103 104 105 |
# File 'lib/watchmonkey_cli/checker.rb', line 97 def dump! sync do @spool.each do |t, | while .any? @checker.send(t, "#{str_descriptor}#{.shift}", self) end end end end |
#messages ⇒ Object
93 94 95 |
# File 'lib/watchmonkey_cli/checker.rb', line 93 def @spool.map(&:second).flatten end |
#str_descriptor ⇒ Object
89 90 91 |
# File 'lib/watchmonkey_cli/checker.rb', line 89 def str_descriptor "#{descriptor}\n\t" end |
#str_running ⇒ Object
85 86 87 |
# File 'lib/watchmonkey_cli/checker.rb', line 85 def str_running "Running checker #{@checker.class.checker_name} with [#{args.join(" | ")}]" end |
#str_safe ⇒ Object
81 82 83 |
# File 'lib/watchmonkey_cli/checker.rb', line 81 def str_safe "#{descriptor}\n\t" end |
#sync(&block) ⇒ Object
73 74 75 |
# File 'lib/watchmonkey_cli/checker.rb', line 73 def sync &block @mutex.synchronize(&block) end |
#uniqid(additional = []) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/watchmonkey_cli/checker.rb', line 66 def uniqid additional = [] ([ self.class.name, @args.map(&:to_s).to_s, ] + additional).join("/") end |