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.
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_refs ⇒ Object
Returns the value of attribute direct_refs.
205 206 207 |
# File 'lib/apiobjects.rb', line 205 def direct_refs @direct_refs end |
#name ⇒ Object
Returns the value of attribute name.
205 206 207 |
# File 'lib/apiobjects.rb', line 205 def name @name end |
#post_refs ⇒ Object
Returns the value of attribute post_refs.
205 206 207 |
# File 'lib/apiobjects.rb', line 205 def post_refs @post_refs end |
#ref ⇒ Object
Returns the value of attribute ref.
205 206 207 |
# File 'lib/apiobjects.rb', line 205 def ref @ref end |
#schema ⇒ Object
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_s ⇒ Object
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 |