Class: R2OAS::Schema::V3::FromFiles::BaseRef

Inherits:
Object
  • Object
show all
Defined in:
lib/r2-oas/schema/v3/object/from_files/utils/refs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



14
15
16
# File 'lib/r2-oas/schema/v3/object/from_files/utils/refs.rb', line 14

def parent
  @parent
end

Instance Method Details

#[](key) ⇒ Object



26
27
28
# File 'lib/r2-oas/schema/v3/object/from_files/utils/refs.rb', line 26

def [](key)
  send(key)
end

#[]=(key, value) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/r2-oas/schema/v3/object/from_files/utils/refs.rb', line 16

def []=(key, value)
  if writable_keys.include?(key)
    send(:"#{key}=", value)
    value
  else
    display_key = key.is_a?(Symbol) ? ":#{key}" : key
    raise ::R2OAS::RefInvalidAssignment, "invalid method `[#{display_key}]=' called for #{self}"
  end
end

#pretty_print(q) ⇒ Object



10
11
12
# File 'lib/r2-oas/schema/v3/object/from_files/utils/refs.rb', line 10

def pretty_print(q)
  pp_hash(q, to_h)
end

#to_hObject



30
31
32
33
34
# File 'lib/r2-oas/schema/v3/object/from_files/utils/refs.rb', line 30

def to_h
  valid_keys.each_with_object({}) do |key, result|
    result[key] = send(key)
  end
end