Module: Horatio::Detector::IOHandler
- Included in:
- Docker, Dynamic, Maven, NodePackage
- Defined in:
- lib/horatio/detector/io_handler.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Class Method Summary collapse
Instance Method Summary collapse
- #default_input ⇒ Object
- #default_output ⇒ Object
- #detect ⇒ Object
- #initialize(input: nil, output: nil) ⇒ Object
- #memo_read ⇒ Object
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
10 11 12 |
# File 'lib/horatio/detector/io_handler.rb', line 10 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/horatio/detector/io_handler.rb', line 10 def output @output end |
Class Method Details
.included(base) ⇒ Object
39 40 41 |
# File 'lib/horatio/detector/io_handler.rb', line 39 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#default_input ⇒ Object
12 13 14 |
# File 'lib/horatio/detector/io_handler.rb', line 12 def default_input 'horatio.json' end |
#default_output ⇒ Object
16 17 18 |
# File 'lib/horatio/detector/io_handler.rb', line 16 def default_output 'horatio.json' end |
#detect ⇒ Object
27 28 29 |
# File 'lib/horatio/detector/io_handler.rb', line 27 def detect File.exists?(@input) ? true : nil end |
#initialize(input: nil, output: nil) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/horatio/detector/io_handler.rb', line 20 def initialize(input: nil, output: nil) @input = input || default_input @output = output || default_output @info = {} @read = false end |
#memo_read ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/horatio/detector/io_handler.rb', line 31 def memo_read return @info if @read return unless block_given? @info = yield @read = true @info end |