Class: Walnut::Output::Standard
- Inherits:
-
Object
- Object
- Walnut::Output::Standard
- Defined in:
- lib/walnut/output/standard.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(parent) ⇒ Standard
constructor
Initialize an object.
-
#puts(string) ⇒ Object
Write a string with a newline to the output.
-
#write(string) ⇒ Numeric
Write a string to the output.
Constructor Details
#initialize(parent) ⇒ Standard
Initialize an object
18 19 20 21 |
# File 'lib/walnut/output/standard.rb', line 18 def initialize(parent) @walnut = parent @output = $stdout end |
Instance Attribute Details
#output ⇒ Object
Note:
#output defaults to $stdout
12 13 14 |
# File 'lib/walnut/output/standard.rb', line 12 def output @output end |
Instance Method Details
#puts(string) ⇒ Object
Write a string with a newline to the output.
37 38 39 |
# File 'lib/walnut/output/standard.rb', line 37 def puts(string) write(string + "\n") end |
#write(string) ⇒ Numeric
Write a string to the output
28 29 30 31 |
# File 'lib/walnut/output/standard.rb', line 28 def write(string) @output.write(string.to_s) string.to_s.length end |