Class: Logger
- Inherits:
-
Object
- Object
- Logger
- Defined in:
- lib/raramorph/logger.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
- #info(string, require_verbose = false) ⇒ Object
-
#initialize(verbose = nil, output = nil) ⇒ Logger
constructor
A new instance of Logger.
- #log ⇒ Object
Constructor Details
#initialize(verbose = nil, output = nil) ⇒ Logger
Returns a new instance of Logger.
5 6 7 8 9 |
# File 'lib/raramorph/logger.rb', line 5 def initialize(verbose = nil , output = nil ) @verbose = verbose @output = output @stream = StringIO.new end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
4 5 6 |
# File 'lib/raramorph/logger.rb', line 4 def output @output end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
4 5 6 |
# File 'lib/raramorph/logger.rb', line 4 def verbose @verbose end |
Instance Method Details
#info(string, require_verbose = false) ⇒ Object
11 12 13 |
# File 'lib/raramorph/logger.rb', line 11 def info string , require_verbose = false @stream.puts(string) #if ( require_verbose && @verbose || ! require_verbose ) end |
#log ⇒ Object
15 16 17 18 19 |
# File 'lib/raramorph/logger.rb', line 15 def log return puts @stream.string if @output.nil? File.open(@output , "w") { |f| f.puts @stream.string } end |