Sha256: 65ca4729fab301a8440ac9bb8a159986c3b413b18a7ed19756b2ce515ceb2d71

Contents?: true

Size: 710 Bytes

Versions: 6

Compression:

Stored size: 710 Bytes

Contents

module RailsAssist
  module TemplateLanguage
    class Haml < Base
      def insert_ruby_statement statement, options = {}
        "\n= #{statement}"
      end
      
      def insert_ruby_block statement, options = {}, &block
        # get indentation of previous line
        %Q{"<%= #{statement} %>"
#{yield}
<% end %>
}
      end      

      def insert_tag tag, options= {}, &block
        attributes = options[:attributes]
        atr_atr = "{#{format attributes}}" if attributes
        %Q{"%#{tag}#{atr_atr}"
#{yield}
<#{tag}/>
}
      end      
      
      protected
      
      def format attributes
        attributes.map{|key, value| ":#{key} => \"#{value}\""}        
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_artifactor-0.5.0 lib/rails_artifactor/template_language/haml.rb
rails_artifactor-0.4.0 lib/rails_artifactor/template_language/haml.rb
rails_artifactor-0.3.6 lib/rails_artifactor/template_language/haml.rb
rails_artifactor-0.3.5 lib/rails_artifactor/template_language/haml.rb
rails_artifactor-0.3.4 lib/rails_artifactor/template_language/haml.rb
rails_artifactor-0.3.3 lib/rails_artifactor/template_language/haml.rb