Class: Rayo::Config::Format
- Inherits:
-
Object
- Object
- Rayo::Config::Format
- Defined in:
- lib/rayo/config/format.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#renderable_exts ⇒ Object
readonly
Returns the value of attribute renderable_exts.
Instance Method Summary collapse
-
#add_filter(from, &filter) ⇒ Object
Add filter.
- #filter(from) ⇒ Object
-
#initialize(name) ⇒ Format
constructor
A new instance of Format.
Constructor Details
#initialize(name) ⇒ Format
Returns a new instance of Format.
6 7 8 9 10 |
# File 'lib/rayo/config/format.rb', line 6 def initialize( name ) @name = name.to_s @filters = { @name => lambda{|source| source} } @renderable_exts = [ ".#{name}" ] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rayo/config/format.rb', line 3 def name @name end |
#renderable_exts ⇒ Object (readonly)
Returns the value of attribute renderable_exts.
4 5 6 |
# File 'lib/rayo/config/format.rb', line 4 def renderable_exts @renderable_exts end |
Instance Method Details
#add_filter(from, &filter) ⇒ Object
Add filter
16 17 18 19 |
# File 'lib/rayo/config/format.rb', line 16 def add_filter( from, &filter ) @filters[from.to_s] = filter @renderable_exts << ".#{from}" unless @renderable_exts.include? ".#{from}" end |
#filter(from) ⇒ Object
21 22 23 |
# File 'lib/rayo/config/format.rb', line 21 def filter( from ) @filters[from.to_s] end |