Class: Ssource::Source::Variable

Inherits:
Element
  • Object
show all
Defined in:
lib/ssource/source/variable.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#accessibility, #body_length, #body_offset, #elements, #kind, #length, #name, #name_length, #name_offset, #offset

Instance Method Summary collapse

Methods inherited from Element

#display_name

Constructor Details

#initialize(json) ⇒ Variable

Returns a new instance of Variable.



5
6
7
8
# File 'lib/ssource/source/variable.rb', line 5

def initialize(json)
  super
  @typename = json['typename']
end

Instance Attribute Details

#typenameObject (readonly)

Returns the value of attribute typename.



4
5
6
# File 'lib/ssource/source/variable.rb', line 4

def typename
  @typename
end

Instance Method Details

#pretty_printObject



14
15
16
# File 'lib/ssource/source/variable.rb', line 14

def pretty_print
  to_hash
end

#to_hashObject



10
11
12
# File 'lib/ssource/source/variable.rb', line 10

def to_hash
  "#{name}: #{typename}"
end