Top Level Namespace

Defined Under Namespace

Modules: Staticz Classes: Colors

Instance Method Summary collapse

Instance Method Details

#javascript(path) ⇒ Object



24
25
26
# File 'lib/helpers.rb', line 24

def javascript(path)
  "<script src=\"#{path}\"></script>"
end


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

def link(path, text: nil, &block)
  if block
    content = capture_haml(&block)
    "<a href=\"#{path}\">#{content}</a>"
  else
    "<a href=\"#{path}\">#{text}</a>"
  end
end

#render(component, &block) ⇒ Object



1
2
3
4
5
6
7
8
9
# File 'lib/helpers.rb', line 1

def render(component, &block)
  engine = ::Haml::Engine.new(File.read("src/#{component}.haml"))

  if block
    engine.render({}, &block)
  else
    engine.render
  end
end

#stylesheet(path) ⇒ Object



20
21
22
# File 'lib/helpers.rb', line 20

def stylesheet(path)
  "<link href=\"#{path}\" rel=\"stylesheet\">"
end