class Ssource::Source::Element

Attributes

accessibility[R]
body_length[R]
body_offset[R]
elements[R]
kind[R]
length[R]
name[R]
name_length[R]
name_offset[R]
offset[R]

Public Class Methods

new(json) click to toggle source
# File lib/ssource/source/element.rb, line 8
def initialize(json)
  @name = json['name']
  @accessibility = json['accessibility']
  @kind = json['kind']

  @offset = json['offset']
  @length = json['length']
  @name_offset = json['nameoffset']
  @name_length = json['namelength']
  @body_offset = json['bodyoffset']
  @body_length = json['bodylength']

  @elements = json.fetch('substructure', []).reduce([]) do |arr, structure|
    arr << Factory.build(structure)
  end
end

Public Instance Methods

display_name() click to toggle source
# File lib/ssource/source/element.rb, line 25
def display_name
  name
end
pretty_print() click to toggle source
# File lib/ssource/source/element.rb, line 33
def pretty_print
  display_name
end
to_hash() click to toggle source
# File lib/ssource/source/element.rb, line 29
def to_hash
  { 'name' => display_name }
end