Module: Fairytale::Helpers
- Included in:
- Fairytale
- Defined in:
- lib/fairytale/helpers.rb
Instance Method Summary collapse
- #erb(file, params = {}, &block) ⇒ Object
- #md(file, params = {}, &block) ⇒ Object
- #md5(file) ⇒ Object
- #sass(file, params = {}, &block) ⇒ Object
- #scss(file, params = {}, &block) ⇒ Object
- #tilt(file, engine_options = {}, &block) ⇒ Object
Instance Method Details
#erb(file, params = {}, &block) ⇒ Object
13 14 15 16 |
# File 'lib/fairytale/helpers.rb', line 13 def erb file, params = {}, &block file = "#{Fairytale.path}/views/#{file.to_s}.erb" if file.class == Symbol tilt(file, params, &block) end |
#md(file, params = {}, &block) ⇒ Object
8 9 10 11 |
# File 'lib/fairytale/helpers.rb', line 8 def md file, params = {}, &block file = "#{Fairytale.path}/content/#{file.to_s}.md" if file.class == Symbol tilt(file, params, &block) end |
#md5(file) ⇒ Object
34 35 36 |
# File 'lib/fairytale/helpers.rb', line 34 def md5 file Digest::SHA1.hexdigest File.read(file) end |
#sass(file, params = {}, &block) ⇒ Object
18 19 20 21 |
# File 'lib/fairytale/helpers.rb', line 18 def sass file, params = {}, &block file = "#{Fairytale.path}/public/assets/css/#{file.to_s}.sass" if file.class == Symbol tilt(file, params, &block) end |
#scss(file, params = {}, &block) ⇒ Object
23 24 25 26 |
# File 'lib/fairytale/helpers.rb', line 23 def scss file, params = {}, &block file = "#{Fairytale.path}/public/assets/css/#{file.to_s}.scss" if file.class == Symbol tilt(file, params, &block) end |
#tilt(file, engine_options = {}, &block) ⇒ Object
28 29 30 31 32 |
# File 'lib/fairytale/helpers.rb', line 28 def tilt file, = {}, &block ||= {} template = Tilt.new file.to_s, nil, template.render(self) { block.call } end |