Class: HaveAPI::GoClient::Parameters::Base
- Inherits:
-
Object
- Object
- HaveAPI::GoClient::Parameters::Base
- Includes:
- Utils
- Defined in:
- lib/haveapi/go_client/parameters/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#go_in_type ⇒ String
readonly
Go type for action input.
-
#go_name ⇒ String
readonly
Parameter name in Go.
-
#go_out_type ⇒ String
readonly
Go type for action output.
- #io ⇒ InputOutput readonly
-
#name ⇒ String
readonly
Parameter name in the API.
-
#type ⇒ String
readonly
HaveAPI data type.
Class Method Summary collapse
-
.handle {|role, direction, name, desc| ... } ⇒ Object
Register the parameter handler.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(io, name, desc) ⇒ Base
constructor
A new instance of Base.
- #nillable? ⇒ Boolean
- #resolve ⇒ Object
Methods included from Utils
Constructor Details
#initialize(io, name, desc) ⇒ Base
Returns a new instance of Base.
45 46 47 48 49 50 51 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 45 def initialize(io, name, desc) @io = io @name = name @type = desc[:type] @desc = desc @go_name = camelize(name) end |
Instance Attribute Details
#go_in_type ⇒ String (readonly)
Go type for action input
39 40 41 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 39 def go_in_type @go_in_type end |
#go_name ⇒ String (readonly)
Parameter name in Go
35 36 37 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 35 def go_name @go_name end |
#go_out_type ⇒ String (readonly)
Go type for action output
43 44 45 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 43 def go_out_type @go_out_type end |
#io ⇒ InputOutput (readonly)
23 24 25 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 23 def io @io end |
#name ⇒ String (readonly)
Parameter name in the API
27 28 29 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 27 def name @name end |
#type ⇒ String (readonly)
HaveAPI data type
31 32 33 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 31 def type @type end |
Class Method Details
.handle {|role, direction, name, desc| ... } ⇒ Object
Register the parameter handler
The block is called whenever a new parameter is to be instantiated. If this class supports the parameter, the block returns true, else false. The first class to return true is used.
18 19 20 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 18 def self.handle(&block) Parameter.register(self, block) end |
Instance Method Details
#<=>(other) ⇒ Object
62 63 64 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 62 def <=>(other) go_name <=> other end |
#nillable? ⇒ Boolean
58 59 60 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 58 def nillable? false end |
#resolve ⇒ Object
53 54 55 56 |
# File 'lib/haveapi/go_client/parameters/base.rb', line 53 def resolve do_resolve @desc = nil end |