Class: Potatochop::Spud
- Inherits:
-
Object
- Object
- Potatochop::Spud
- Defined in:
- lib/potatochop/spud.rb
Instance Method Summary collapse
- #get_css(file_name) ⇒ Object
- #get_file(file_name) ⇒ Object
- #get_html(file_name) ⇒ Object
-
#initialize(interface) ⇒ Spud
constructor
A new instance of Spud.
Constructor Details
#initialize(interface) ⇒ Spud
Returns a new instance of Spud.
3 4 5 |
# File 'lib/potatochop/spud.rb', line 3 def initialize(interface) @interface = interface end |
Instance Method Details
#get_css(file_name) ⇒ Object
19 20 21 22 23 24 25 |
# 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) ⇒ Object
7 8 9 |
# 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) ⇒ Object
11 12 13 14 15 16 17 |
# 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 |