Class: JSON5::MemberNode

Inherits:
Node
  • Object
show all
Defined in:
lib/json5/document_nodes.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#end_byte, #leading_trivia, #raw_span, #source, #start_byte, #trailing_trivia, #type

Instance Method Summary collapse

Methods inherited from Node

#raw

Constructor Details

#initialize(name:, value:, colon_start_byte:, colon_end_byte:, colon_leading_trivia: [], **attributes) ⇒ MemberNode

Returns a new instance of MemberNode.



70
71
72
73
74
75
76
77
78
# File 'lib/json5/document_nodes.rb', line 70

def initialize(name:, value:, colon_start_byte:, colon_end_byte:, colon_leading_trivia: [], **attributes)
  @name = name
  @value = value
  @colon_start_byte = colon_start_byte
  @colon_end_byte = colon_end_byte
  @colon_span = ByteSpan.new(colon_start_byte, colon_end_byte)
  @colon_leading_trivia = colon_leading_trivia.dup.freeze
  super(type: :member, **attributes)
end

Instance Attribute Details

#colon_end_byteObject (readonly)

Returns the value of attribute colon_end_byte.



68
69
70
# File 'lib/json5/document_nodes.rb', line 68

def colon_end_byte
  @colon_end_byte
end

#colon_leading_triviaObject (readonly)

Returns the value of attribute colon_leading_trivia.



68
69
70
# File 'lib/json5/document_nodes.rb', line 68

def colon_leading_trivia
  @colon_leading_trivia
end

#colon_spanObject (readonly)

Returns the value of attribute colon_span.



68
69
70
# File 'lib/json5/document_nodes.rb', line 68

def colon_span
  @colon_span
end

#colon_start_byteObject (readonly)

Returns the value of attribute colon_start_byte.



68
69
70
# File 'lib/json5/document_nodes.rb', line 68

def colon_start_byte
  @colon_start_byte
end

#nameObject (readonly)

Returns the value of attribute name.



68
69
70
# File 'lib/json5/document_nodes.rb', line 68

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



68
69
70
# File 'lib/json5/document_nodes.rb', line 68

def value
  @value
end