Module: EventEngine::EventDefinition::Inputs::ClassMethods
- Defined in:
- lib/event_engine/event_definition/inputs.rb
Instance Method Summary collapse
-
#input(name) ⇒ Object
Declares a required input for this event.
-
#inputs ⇒ Hash{Symbol => Symbol}
Returns all declared inputs as a hash of name => :required/:optional.
-
#optional_input(name) ⇒ Object
Declares an optional input for this event.
Instance Method Details
#input(name) ⇒ Object
Declares a required input for this event.
14 15 16 17 18 19 20 |
# File 'lib/event_engine/event_definition/inputs.rb', line 14 def input(name) name = name.to_sym if inputs.key?(name) raise ArgumentError, "duplicate input: #{name}" end inputs[name] = :required end |
#inputs ⇒ Hash{Symbol => Symbol}
Returns all declared inputs as a hash of name => :required/:optional.
37 38 39 |
# File 'lib/event_engine/event_definition/inputs.rb', line 37 def inputs @inputs ||= {} end |
#optional_input(name) ⇒ Object
Declares an optional input for this event.
26 27 28 29 30 31 32 |
# File 'lib/event_engine/event_definition/inputs.rb', line 26 def optional_input(name) name = name.to_sym if inputs.key?(name) raise ArgumentError, "duplicate input: #{name}" end inputs[name] = :optional end |