Class: Dwarves::Parser::Attribute
- Defined in:
- lib/dwarves/parser/4/ast.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_s ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Attribute
Returns a new instance of Attribute.
89 90 91 92 93 |
# File 'lib/dwarves/parser/4/ast.rb', line 89 def initialize opts = {} @name = opts[:name] @value = opts[:value] @address = opts[:address] end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
87 88 89 |
# File 'lib/dwarves/parser/4/ast.rb', line 87 def address @address end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
87 88 89 |
# File 'lib/dwarves/parser/4/ast.rb', line 87 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
87 88 89 |
# File 'lib/dwarves/parser/4/ast.rb', line 87 def value @value end |
Instance Method Details
#to_s ⇒ Object
95 96 97 98 99 |
# File 'lib/dwarves/parser/4/ast.rb', line 95 def to_s formatted_address = "<#{@address}>".ljust(3, " ") formatted_name = name.to_s.ljust(18, " ") + ":" " #{formatted_address} #{formatted_name} #{@value}" end |