Module: Sinatra::Editable::Helpers

Defined in:
lib/sinatra/editable.rb

Instance Method Summary collapse

Instance Method Details

#editable(item) ⇒ Object



7
8
9
10
11
12
# File 'lib/sinatra/editable.rb', line 7

def editable(item)
  path = "#{settings.root}/#{settings.editable_dir}/#{item.to_s}.html"
  if editable_exist?(item)
    File.read(path)
  end
end

#editable_exist?(item) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/sinatra/editable.rb', line 14

def editable_exist?(item)
  path = "#{settings.root}/#{settings.editable_dir}/#{item.to_s}.html"
  File.exist?(path)
end