Class: Prettyp::FormatterRegistry
- Inherits:
-
Object
- Object
- Prettyp::FormatterRegistry
- Defined in:
- lib/prettyp/formatter_registry.rb
Instance Attribute Summary collapse
-
#formatters ⇒ Object
readonly
Returns the value of attribute formatters.
Instance Method Summary collapse
- #formatter_for(language) ⇒ Object
-
#initialize(formatters = Formatter::BaseFormatter.inherited_classes) ⇒ FormatterRegistry
constructor
A new instance of FormatterRegistry.
Constructor Details
#initialize(formatters = Formatter::BaseFormatter.inherited_classes) ⇒ FormatterRegistry
6 7 8 |
# File 'lib/prettyp/formatter_registry.rb', line 6 def initialize formatters = Formatter::BaseFormatter.inherited_classes determine_formatters formatters end |
Instance Attribute Details
#formatters ⇒ Object (readonly)
Returns the value of attribute formatters.
4 5 6 |
# File 'lib/prettyp/formatter_registry.rb', line 4 def formatters @formatters end |
Instance Method Details
#formatter_for(language) ⇒ Object
10 11 12 |
# File 'lib/prettyp/formatter_registry.rb', line 10 def formatter_for language formatters[format_language_key(language)].first end |