Class: SchemaInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/apiobjects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ref, name, schema) ⇒ SchemaInfo

Returns a new instance of SchemaInfo.



207
208
209
210
211
212
213
# File 'lib/apiobjects.rb', line 207

def initialize(ref, name, schema)
  @ref = ref
  @name = name
  @schema = schema
  @direct_refs = {}
  gather_refs(@direct_refs, schema)
end

Instance Attribute Details

#direct_refsObject

Returns the value of attribute direct_refs.



205
206
207
# File 'lib/apiobjects.rb', line 205

def direct_refs
  @direct_refs
end

#nameObject

Returns the value of attribute name.



205
206
207
# File 'lib/apiobjects.rb', line 205

def name
  @name
end

#post_refsObject

Returns the value of attribute post_refs.



205
206
207
# File 'lib/apiobjects.rb', line 205

def post_refs
  @post_refs
end

#refObject

Returns the value of attribute ref.



205
206
207
# File 'lib/apiobjects.rb', line 205

def ref
  @ref
end

#schemaObject

Returns the value of attribute schema.



205
206
207
# File 'lib/apiobjects.rb', line 205

def schema
  @schema
end

Instance Method Details

#set_post_refs(seen) ⇒ Object



215
216
217
# File 'lib/apiobjects.rb', line 215

def set_post_refs(seen)
  @post_refs = Set.new(@direct_refs.keys) - seen
end

#to_sObject



219
220
221
222
# File 'lib/apiobjects.rb', line 219

def to_s
  v = @direct_refs.keys.sort.map { |k| "#{k}:#{@direct_refs[k] ? 'req' : 'opt'}" }
  "#{@ref}: #{v.join(' ')}"
end