Module: Fairytale

Includes:
Helpers
Defined in:
lib/fairytale.rb,
lib/fairytale/helpers.rb,
lib/fairytale/version.rb

Defined Under Namespace

Modules: Helpers

Constant Summary collapse

VERSION =
"1.0.0"

Instance Method Summary collapse

Methods included from Helpers

#erb, #md, #md5, #sass, #scss, #tilt

Instance Method Details

#before(&block) ⇒ Object

Present merely to mirror Sinatra



30
31
32
# File 'lib/fairytale.rb', line 30

def before &block
  block.call
end

#get(url, layout = "views/layout.erb", &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fairytale.rb', line 12

def get url, layout = "views/layout.erb", &block
  @url = url

  print "Building #{url} ... "
  view_content = block.call

  unless layout.nil?
    view_content = tilt(layout) { view_content }
  end

  save url, view_content
  print "saved"

  reset
  puts
end

#pathObject



8
9
10
# File 'lib/fairytale.rb', line 8

def path
  File.expand_path "./"
end