Class: Rayo::Models::Renderable
- Inherits:
-
Object
- Object
- Rayo::Models::Renderable
- Defined in:
- lib/rayo/models/renderable.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
-
#initialize(storage, file, format, filter) ⇒ Renderable
constructor
A new instance of Renderable.
- #render(parser) ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(storage, file, format, filter) ⇒ Renderable
Returns a new instance of Renderable.
8 9 10 11 12 13 |
# File 'lib/rayo/models/renderable.rb', line 8 def initialize( storage, file, format, filter ) @storage = storage @file = file @format = format @filter = filter end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
4 5 6 |
# File 'lib/rayo/models/renderable.rb', line 4 def file @file end |
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
6 7 8 |
# File 'lib/rayo/models/renderable.rb', line 6 def filter @filter end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/rayo/models/renderable.rb', line 5 def format @format end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
3 4 5 |
# File 'lib/rayo/models/renderable.rb', line 3 def storage @storage end |
Instance Method Details
#render(parser) ⇒ Object
19 20 21 22 23 |
# File 'lib/rayo/models/renderable.rb', line 19 def render( parser ) parser.context.with_format @format do filter.call( parser.parse( source ) ) end end |
#source ⇒ Object
15 16 17 |
# File 'lib/rayo/models/renderable.rb', line 15 def source @source ||= @storage.load( file ) end |