Class: RaaP::Value::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/raap/value/variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#typeObject (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

#classObject



22
# File 'lib/raap/value/variable.rb', line 22

def class = Variable

#inspectObject



21
# File 'lib/raap/value/variable.rb', line 21

def inspect = "#<var #{type}>"