Class: ApiSchema::Response
- Inherits:
-
Object
- Object
- ApiSchema::Response
- Defined in:
- lib/api_schema/response.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(code, model) ⇒ Response
constructor
A new instance of Response.
- #method_missing(type, *args, &block) ⇒ Object
Constructor Details
#initialize(code, model) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 |
# File 'lib/api_schema/response.rb', line 6 def initialize(code, model) @code = code @model = model @fields = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(type, *args, &block) ⇒ Object
12 13 14 15 |
# File 'lib/api_schema/response.rb', line 12 def method_missing(type, *args, &block) = args[1] || {} @fields << Field.new(type, args[0], ) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/api_schema/response.rb', line 4 def code @code end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
4 5 6 |
# File 'lib/api_schema/response.rb', line 4 def fields @fields end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'lib/api_schema/response.rb', line 4 def model @model end |