Class: Ellipses::Client::Directive
- Inherits:
-
Object
- Object
- Ellipses::Client::Directive
- Defined in:
- lib/ellipses/client/directive.rb
Constant Summary collapse
- Error =
Class.new Error
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #execute(**kwargs) ⇒ Object
-
#initialize(lexemes, server) ⇒ Directive
constructor
A new instance of Directive.
Constructor Details
#initialize(lexemes, server) ⇒ Directive
Returns a new instance of Directive.
10 11 12 13 |
# File 'lib/ellipses/client/directive.rb', line 10 def initialize(lexemes, server) @server = server @commands = build(lexemes) end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
8 9 10 |
# File 'lib/ellipses/client/directive.rb', line 8 def commands @commands end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
8 9 10 |
# File 'lib/ellipses/client/directive.rb', line 8 def server @server end |
Instance Method Details
#execute(**kwargs) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/ellipses/client/directive.rb', line 15 def execute(**kwargs) output = [] commands.each do |command| output = command.call(input = output, **kwargs) || input end output end |