Sha256: 1f50a012947271fb7bcf597323775f75021a6ef68116a1780522969067acc63b

Contents?: true

Size: 537 Bytes

Versions: 22

Compression:

Stored size: 537 Bytes

Contents

module Faalis
  module Generators
    module Concerns
      # This concern will add `render` method to generators which load
      # template partials
      module Render

        private

        def render(source, &block)
          source  = File.expand_path(find_in_source_paths("#{source.to_s}.erb"))
          context = instance_eval('binding')

          content = ERB.new(::File.binread(source), nil, '-').result(binding)
          content = block.call(content) if block
          content
        end

      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
faalis-2.0.0.rc6 lib/faalis/generators/concerns/render.rb
faalis-2.0.0.rc5 lib/faalis/generators/concerns/render.rb
faalis-2.0.0.rc4 lib/faalis/generators/concerns/render.rb
faalis-2.0.0.rc3 lib/faalis/generators/concerns/render.rb
faalis-2.0.0.rc2 lib/faalis/generators/concerns/render.rb
faalis-1.0.0 lib/faalis/generators/concerns/render.rb
faalis-1.0.0.alpha4 lib/faalis/generators/concerns/render.rb
faalis-1.0.0.alpha3 lib/faalis/generators/concerns/render.rb
faalis-1.0.0.alpha2 lib/faalis/generators/concerns/render.rb
faalis-1.0.0.alpha1 lib/faalis/generators/concerns/render.rb
faalis-1.0.0.alpha0 lib/faalis/generators/concerns/render.rb
faalis-0.26.3 lib/faalis/generators/concerns/render.rb
faalis-0.26.2 lib/faalis/generators/concerns/render.rb
faalis-0.26.1 lib/faalis/generators/concerns/render.rb
faalis-0.26.0 lib/faalis/generators/concerns/render.rb
faalis-0.25.1 lib/faalis/generators/concerns/render.rb
faalis-0.25.0 lib/faalis/generators/concerns/render.rb
faalis-0.24.4 lib/faalis/generators/concerns/render.rb
faalis-0.24.3 lib/faalis/generators/concerns/render.rb
faalis-0.24.2 lib/faalis/generators/concerns/render.rb