Class: SlideDown
- Inherits:
-
Object
- Object
- SlideDown
- Defined in:
- lib/slidedown.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw) ⇒ SlideDown
constructor
Ensures that the first slide has proper !SLIDE declaration.
- #read(path) ⇒ Object
- #render ⇒ Object
- #slides ⇒ Object
Constructor Details
#initialize(raw) ⇒ SlideDown
Ensures that the first slide has proper !SLIDE declaration
18 19 20 21 |
# File 'lib/slidedown.rb', line 18 def initialize(raw) @raw = raw =~ /\A!SLIDE/ ? raw : "!SLIDE\n#{raw}" extract_classes! end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
11 12 13 |
# File 'lib/slidedown.rb', line 11 def classes @classes end |
Class Method Details
.render(args) ⇒ Object
13 14 15 |
# File 'lib/slidedown.rb', line 13 def self.render(args) new(File.read(File.join(Dir.pwd, *args))).render end |
Instance Method Details
#read(path) ⇒ Object
27 28 29 |
# File 'lib/slidedown.rb', line 27 def read(path) File.read(File.dirname(__FILE__) + '/../templates/%s' % path) end |
#render ⇒ Object
31 32 33 34 |
# File 'lib/slidedown.rb', line 31 def render template = File.read(File.dirname(__FILE__) + '/../templates/template.erb') ERB.new(template).result(binding) end |