Class: SeeingIsBelieving::Binary::LineFormatter
- Inherits:
-
Object
- Object
- SeeingIsBelieving::Binary::LineFormatter
- Defined in:
- lib/seeing_is_believing/binary/line_formatter.rb
Instance Attribute Summary collapse
-
#line ⇒ Object
Returns the value of attribute line.
-
#options ⇒ Object
Returns the value of attribute options.
-
#result ⇒ Object
Returns the value of attribute result.
-
#separator ⇒ Object
Returns the value of attribute separator.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(line, separator, result, options) ⇒ LineFormatter
constructor
A new instance of LineFormatter.
Constructor Details
#initialize(line, separator, result, options) ⇒ LineFormatter
Returns a new instance of LineFormatter.
6 7 8 9 10 11 |
# File 'lib/seeing_is_believing/binary/line_formatter.rb', line 6 def initialize(line, separator, result, ) self.line = line self.separator = separator self.result = result.gsub "\n", '\n' self. = end |
Instance Attribute Details
#line ⇒ Object
Returns the value of attribute line.
4 5 6 |
# File 'lib/seeing_is_believing/binary/line_formatter.rb', line 4 def line @line end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/seeing_is_believing/binary/line_formatter.rb', line 4 def @options end |
#result ⇒ Object
Returns the value of attribute result.
4 5 6 |
# File 'lib/seeing_is_believing/binary/line_formatter.rb', line 4 def result @result end |
#separator ⇒ Object
Returns the value of attribute separator.
4 5 6 |
# File 'lib/seeing_is_believing/binary/line_formatter.rb', line 4 def separator @separator end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 |
# File 'lib/seeing_is_believing/binary/line_formatter.rb', line 13 def call return line unless sep_plus_result.start_with? separator return line unless formatted_line.start_with? "#{line_with_padding}#{separator}" formatted_line end |