Class: Erector::Dependency
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(type, text, options = {}) ⇒ Dependency
constructor
A new instance of Dependency.
Constructor Details
#initialize(type, text, options = {}) ⇒ Dependency
Returns a new instance of Dependency.
5 6 7 8 9 |
# File 'lib/erector/dependency.rb', line 5 def initialize(type, text, = {}) text = text.read if text.is_a? IO text = self.class.interpolate(text) if [:interpolate] # todo: test @type, @text, @options = type, text, end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/erector/dependency.rb', line 3 def @options end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'lib/erector/dependency.rb', line 3 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/erector/dependency.rb', line 3 def type @type end |
Class Method Details
.interpolate(s) ⇒ Object
11 12 13 |
# File 'lib/erector/dependency.rb', line 11 def self.interpolate(s) eval("<<INTERPOLATE\n" + s + "\nINTERPOLATE").chomp end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 18 19 |
# File 'lib/erector/dependency.rb', line 15 def ==(other) (self.type == other.type and self.text == other.text and self. == other.) ? true : false end |
#eql?(other) ⇒ Boolean
21 22 23 |
# File 'lib/erector/dependency.rb', line 21 def eql?(other) self == other end |
#hash ⇒ Object
25 26 27 28 |
# File 'lib/erector/dependency.rb', line 25 def hash # this is a fairly inefficient hash function but it does the trick for now "#{type}#{text}#{}".hash end |