Sha256: 93be923465d9b02335640cad399832d783ec4ee76e82b6d0078da44a5c07dc48

Contents?: true

Size: 553 Bytes

Versions: 2

Compression:

Stored size: 553 Bytes

Contents

module Erector
  class Dependency
    attr_reader :type, :text, :options

    def initialize(type, text, options = {})
      text = text.read if text.is_a? IO
      text = self.class.interpolate(text) if options[:interpolate] # todo: test
      @type, @text, @options = type, text, options
    end

    def self.interpolate(s)
      eval("<<INTERPOLATE\n" + s + "\nINTERPOLATE").chomp
    end

    def ==(other)
      (self.type == other.type and
       self.text == other.text and
       self.options == other.options) ? true : false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
erector-0.8.1 lib/erector/dependency.rb
erector-0.8.0 lib/erector/dependency.rb