class Plasmoid::Haml
Public Class Methods
generate()
click to toggle source
# File lib/plasmoid/haml.rb, line 25 def self.generate Dir["contents/**/**/*.haml"].each do |path| Plasmoid::Haml.new(path).write end end
new(path)
click to toggle source
# File lib/plasmoid/haml.rb, line 5 def initialize(path) @path = path @output_path = path.sub(/\.haml$/, "") if valid? ::Haml::Engine.new(File.read(@path)).def_method(self, :render) end end
Public Instance Methods
valid?()
click to toggle source
# File lib/plasmoid/haml.rb, line 14 def valid? defined?(::Haml) end
write()
click to toggle source
# File lib/plasmoid/haml.rb, line 18 def write return if !valid? File.open(@output_path, "w") do |f| f.write(self.render) end end