Class: StupidFormatter::AbstractFormatter
- Inherits:
-
Object
- Object
- StupidFormatter::AbstractFormatter
- Defined in:
- lib/stupid_formatter.rb
Overview
Base class for formatters, providing the basic API.
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
-
#initialize(input) ⇒ AbstractFormatter
constructor
A new instance of AbstractFormatter.
- #result ⇒ Object
Constructor Details
#initialize(input) ⇒ AbstractFormatter
Returns a new instance of AbstractFormatter.
50 51 52 53 |
# File 'lib/stupid_formatter.rb', line 50 def initialize(input) @input = input.to_s.strip raise "Please use this only in subclasses" if self.class == AbstractFormatter end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
48 49 50 |
# File 'lib/stupid_formatter.rb', line 48 def input @input end |
Instance Method Details
#result ⇒ Object
55 56 57 |
# File 'lib/stupid_formatter.rb', line 55 def result raise "This should be implemented by subclasses" end |