Class: Shatter::Service::ServiceDefinition
- Inherits:
-
Object
- Object
- Shatter::Service::ServiceDefinition
- Includes:
- Concurrent::Async
- Defined in:
- lib/shatter/service/service_definition.rb
Class Attribute Summary collapse
-
.function_collection ⇒ Object
Returns the value of attribute function_collection.
Class Method Summary collapse
Class Attribute Details
.function_collection ⇒ Object
Returns the value of attribute function_collection.
10 11 12 |
# File 'lib/shatter/service/service_definition.rb', line 10 def function_collection @function_collection end |
Class Method Details
.register_function(identifier, function) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/shatter/service/service_definition.rb', line 18 def self.register_function(identifier, function) @function_collection ||= {} @function_collection[identifier.to_s] = function define_method identifier do |params| function.new(params).call end end |
.to_typescript ⇒ Object
13 14 15 16 |
# File 'lib/shatter/service/service_definition.rb', line 13 def self.to_typescript function_defs = @function_collection.values ERB.new(File.read("#{__dir__}/../../../templates/service_client.ts.erb")).result(binding) end |