Class: SchemaInfo
- Inherits:
-
Object
- Object
- SchemaInfo
- Defined in:
- lib/apiobjects.rb
Instance Attribute Summary collapse
-
#direct_refs ⇒ Object
Returns the value of attribute direct_refs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#post_refs ⇒ Object
Returns the value of attribute post_refs.
-
#ref ⇒ Object
Returns the value of attribute ref.
-
#schema ⇒ Object
Returns the value of attribute schema.
Instance Method Summary collapse
-
#initialize(ref, name, schema) ⇒ SchemaInfo
constructor
A new instance of SchemaInfo.
- #set_post_refs(seen) ⇒ Object
- #to_s ⇒ Object
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_refs ⇒ Object
Returns the value of attribute direct_refs.
199 200 201 |
# File 'lib/apiobjects.rb', line 199 def direct_refs @direct_refs end |
#name ⇒ Object
Returns the value of attribute name.
199 200 201 |
# File 'lib/apiobjects.rb', line 199 def name @name end |
#post_refs ⇒ Object
Returns the value of attribute post_refs.
199 200 201 |
# File 'lib/apiobjects.rb', line 199 def post_refs @post_refs end |
#ref ⇒ Object
Returns the value of attribute ref.
199 200 201 |
# File 'lib/apiobjects.rb', line 199 def ref @ref end |
#schema ⇒ Object
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_s ⇒ Object
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 |