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.



201
202
203
204
205
206
207
# File 'lib/apiobjects.rb', line 201

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.



199
200
201
# File 'lib/apiobjects.rb', line 199

def direct_refs
  @direct_refs
end

#nameObject

Returns the value of attribute name.



199
200
201
# File 'lib/apiobjects.rb', line 199

def name
  @name
end

#post_refsObject

Returns the value of attribute post_refs.



199
200
201
# File 'lib/apiobjects.rb', line 199

def post_refs
  @post_refs
end

#refObject

Returns the value of attribute ref.



199
200
201
# File 'lib/apiobjects.rb', line 199

def ref
  @ref
end

#schemaObject

Returns the value of attribute schema.



199
200
201
# File 'lib/apiobjects.rb', line 199

def schema
  @schema
end

Instance Method Details

#set_post_refs(seen) ⇒ Object



209
210
211
# File 'lib/apiobjects.rb', line 209

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

#to_sObject



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

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