Module: Grudge::Sinatra::Helpers

Defined in:
lib/grudge/helpers.rb

Instance Method Summary collapse

Instance Method Details

#anchor(name, url, options = {}) ⇒ Object



7
8
9
10
11
# File 'lib/grudge/helpers.rb', line 7

def anchor(name, url, options={})
  defaults = {:href => url}
  options_str = hash_to_attributes(defaults.merge(options))
  %Q[<a #{options_str}>#{name}</a>]
end

#repository_nameObject



20
# File 'lib/grudge/helpers.rb', line 20

def repository_name; Grudge::Repository.origin_uri.to_s; end

#set_title(msg) ⇒ Object



4
# File 'lib/grudge/helpers.rb', line 4

def set_title(msg) @title = msg; end

#stylesheet_include(name, options = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/grudge/helpers.rb', line 13

def stylesheet_include(name, options={})
  defaults = {:href => "/stylesheets/#{name}.css", :media => "screen",
    :rel => "stylesheet", :type => "text/css"}
  options_str = hash_to_attributes(defaults.merge(options))
  %Q[<link #{options_str}/>]
end

#titleObject



5
# File 'lib/grudge/helpers.rb', line 5

def title; "Grudge - #{@title}"; end