class Potatochop::Spud

Public Class Methods

new(interface) click to toggle source
# File lib/potatochop/spud.rb, line 3
def initialize(interface)
  @interface = interface
end

Public Instance Methods

get_css(file_name) click to toggle source
# File lib/potatochop/spud.rb, line 19
def get_css(file_name)
  if @interface.exists?("#{file_name}.css")  # Static css
    @interface.read("#{file_name}.css")
  elsif @interface.exists?("#{file_name}.css.scss") # Sass css
    Sass::Engine.new(@interface.read("#{file_name}.css.scss"), :syntax => :scss, :load_paths => [@interface.source]).render
  end
end
get_file(file_name) click to toggle source
# File lib/potatochop/spud.rb, line 7
def get_file(file_name)
  @interface.exists?(file_name) ? @interface.read(file_name) : nil
end
get_html(file_name) click to toggle source
# File lib/potatochop/spud.rb, line 11
def get_html(file_name)
  if @interface.exists?("#{file_name}.html") # Static html first
    @interface.read("#{file_name}.html")
  elsif @interface.exists?("#{file_name}.html.haml") # Haml next
    Haml::Engine.new(@interface.read("#{file_name}.html.haml")).render
  end
end