Class: Typerb::VariableName
- Inherits:
-
Object
- Object
- Typerb::VariableName
- Defined in:
- lib/typerb/variable_name.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(caller_loc) ⇒ VariableName
constructor
A new instance of VariableName.
Constructor Details
#initialize(caller_loc) ⇒ VariableName
Returns a new instance of VariableName.
7 8 9 10 |
# File 'lib/typerb/variable_name.rb', line 7 def initialize(caller_loc) @file = caller_loc[0].path @line = caller_loc[0].lineno end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/typerb/variable_name.rb', line 5 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
5 6 7 |
# File 'lib/typerb/variable_name.rb', line 5 def line @line end |
Instance Method Details
#get ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/typerb/variable_name.rb', line 12 def get return unless defined?(RubyVM::AbstractSyntaxTree) return unless File.exist?(file) caller_method = caller_locations(1, 1)[0].label.to_sym from_ast(caller_method) end |