Class: Ryan::Assignment
- Inherits:
-
Object
- Object
- Ryan::Assignment
- Defined in:
- lib/ryan/assignment.rb
Instance Attribute Summary collapse
-
#sexp ⇒ Object
readonly
Returns the value of attribute sexp.
Instance Method Summary collapse
-
#initialize(sexp) ⇒ Assignment
constructor
A new instance of Assignment.
- #name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(sexp) ⇒ Assignment
Returns a new instance of Assignment.
5 6 7 |
# File 'lib/ryan/assignment.rb', line 5 def initialize(sexp) @sexp = sexp end |
Instance Attribute Details
#sexp ⇒ Object (readonly)
Returns the value of attribute sexp.
3 4 5 |
# File 'lib/ryan/assignment.rb', line 3 def sexp @sexp end |
Instance Method Details
#name ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/ryan/assignment.rb', line 15 def name if sexp.first == :iasgn sexp[1] elsif sexp.first == :op_asgn_or sexp[1][1] end end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/ryan/assignment.rb', line 9 def to_s "assigns #{name}" end |