Class: Contraption::Formatter
- Inherits:
-
Object
- Object
- Contraption::Formatter
- Defined in:
- lib/contraption/formatter.rb
Instance Method Summary collapse
- #format(context, method = nil) ⇒ Object
- #formats ⇒ Object
-
#initialize(location) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(location) ⇒ Formatter
5 6 7 8 |
# File 'lib/contraption/formatter.rb', line 5 def initialize location @source = location find_formats end |
Instance Method Details
#format(context, method = nil) ⇒ Object
10 11 12 |
# File 'lib/contraption/formatter.rb', line 10 def format context, method=nil renderer(method || context.type).result binding end |
#formats ⇒ Object
14 15 16 |
# File 'lib/contraption/formatter.rb', line 14 def formats @formats.keys end |