Class: FuncRunner::FunctionDefinition
- Inherits:
-
Object
- Object
- FuncRunner::FunctionDefinition
- Defined in:
- lib/func_runner/function_definition.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#function_body ⇒ Object
readonly
Returns the value of attribute function_body.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#param_types ⇒ Object
readonly
Returns the value of attribute param_types.
Instance Method Summary collapse
-
#body(&block) ⇒ Object
Define the function body.
- #description(desc) ⇒ Object
-
#initialize(name) ⇒ FunctionDefinition
constructor
A new instance of FunctionDefinition.
-
#params(types) ⇒ Object
Define expected parameter types.
-
#to_h ⇒ Object
Convert to hash for storage.
Constructor Details
#initialize(name) ⇒ FunctionDefinition
Returns a new instance of FunctionDefinition.
7 8 9 10 |
# File 'lib/func_runner/function_definition.rb', line 7 def initialize(name) @name = name @param_types = {} end |
Instance Attribute Details
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
5 6 7 |
# File 'lib/func_runner/function_definition.rb', line 5 def desc @desc end |
#function_body ⇒ Object (readonly)
Returns the value of attribute function_body.
5 6 7 |
# File 'lib/func_runner/function_definition.rb', line 5 def function_body @function_body end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/func_runner/function_definition.rb', line 5 def name @name end |
#param_types ⇒ Object (readonly)
Returns the value of attribute param_types.
5 6 7 |
# File 'lib/func_runner/function_definition.rb', line 5 def param_types @param_types end |
Instance Method Details
#body(&block) ⇒ Object
Define the function body
22 23 24 |
# File 'lib/func_runner/function_definition.rb', line 22 def body(&block) @function_body = block end |
#description(desc) ⇒ Object
17 18 19 |
# File 'lib/func_runner/function_definition.rb', line 17 def description(desc) @desc = desc end |
#params(types) ⇒ Object
Define expected parameter types
13 14 15 |
# File 'lib/func_runner/function_definition.rb', line 13 def params(types) @param_types = types end |
#to_h ⇒ Object
Convert to hash for storage
27 28 29 |
# File 'lib/func_runner/function_definition.rb', line 27 def to_h {name: name, desc: desc, params: param_types, function: function_body} end |