Class: RLSL::FunctionContext
- Inherits:
-
Object
- Object
- RLSL::FunctionContext
- Defined in:
- lib/rlsl/function_context.rb
Instance Attribute Summary collapse
-
#functions ⇒ Object
readonly
Returns the value of attribute functions.
Instance Method Summary collapse
-
#define(name, returns:, params: {}) ⇒ Object
Full form: specify return type and parameter types.
-
#initialize ⇒ FunctionContext
constructor
A new instance of FunctionContext.
Constructor Details
#initialize ⇒ FunctionContext
Returns a new instance of FunctionContext.
7 8 9 |
# File 'lib/rlsl/function_context.rb', line 7 def initialize @functions = {} end |
Instance Attribute Details
#functions ⇒ Object (readonly)
Returns the value of attribute functions.
5 6 7 |
# File 'lib/rlsl/function_context.rb', line 5 def functions @functions end |
Instance Method Details
#define(name, returns:, params: {}) ⇒ Object
Full form: specify return type and parameter types
15 16 17 18 19 20 |
# File 'lib/rlsl/function_context.rb', line 15 def define(name, returns:, params: {}) @functions[name.to_sym] = { returns: validate_type!(returns), params: normalize_params(params) } end |