Sha256: 5a9e22744491c7942df3ef4276a96f82c929881977c6f5978543d11364088925

Contents?: true

Size: 608 Bytes

Versions: 9

Compression:

Stored size: 608 Bytes

Contents

module Blueprints
  module Convertable
    def persist(str)
      File.open(@output_file, 'a+') do |f|
        f.write(str)
      end
    end
    
    def process!
      persist "#{banner_start}#{convert}#{banner_end}"
    end
    
    def banner_start
      "### blueprints from #{@format}\n\n"
    end
    
    def banner_end
      "\n###\n" 
    end
  end

  class Converter
    def self.for(format, options = {})
      require "blueprints/convertable/#{format}"
      Class.new("Blueprints::#{format.capitalize}Converter".constantize) do |options|
        include Convertable
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
blueprints-1.0.1 lib/blueprints/convertable.rb
blueprints-1.0.0 lib/blueprints/convertable.rb
blueprints-0.9.0 lib/blueprints/convertable.rb
blueprints-0.8.2 lib/blueprints/convertable.rb
blueprints-0.8.1 lib/blueprints/convertable.rb
blueprints-0.8.0 lib/blueprints/convertable.rb
blueprints-0.7.3 lib/blueprints/convertable.rb
blueprints-0.7.2 lib/blueprints/convertable.rb
blueprints-0.7.1 lib/blueprints/convertable.rb