Class: StupidFormatter::AbstractFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/stupid_formatter.rb

Overview

Base class for formatters, providing the basic API.

Direct Known Subclasses

Erb, RDiscount

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#inputObject (readonly)

Returns the value of attribute input.



48
49
50
# File 'lib/stupid_formatter.rb', line 48

def input
  @input
end

Instance Method Details

#resultObject



55
56
57
# File 'lib/stupid_formatter.rb', line 55

def result
  raise "This should be implemented by subclasses"
end