Class: RaaP::Value::Variable
- Inherits:
-
Object
- Object
- RaaP::Value::Variable
- Defined in:
- lib/raap/value/variable.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #class ⇒ Object
-
#initialize(type) ⇒ Variable
constructor
A new instance of Variable.
- #inspect ⇒ Object
Constructor Details
#initialize(type) ⇒ Variable
Returns a new instance of Variable.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/raap/value/variable.rb', line 8 def initialize(type) @type = if type.respond_to?(:to_sym) # @type var type: String | Symbol ::RBS::Types::Variable.new(name: type.to_sym, location: nil) else type end unless @type.instance_of?(::RBS::Types::Variable) ::Kernel.raise ::TypeError, "not a variable type: #{@type}" end end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/raap/value/variable.rb', line 6 def type @type end |
Instance Method Details
#class ⇒ Object
22 |
# File 'lib/raap/value/variable.rb', line 22 def class = Variable |
#inspect ⇒ Object
21 |
# File 'lib/raap/value/variable.rb', line 21 def inspect = "#<var #{type}>" |