Class: SlackBot::Args
- Inherits:
-
Object
- Object
- SlackBot::Args
- Defined in:
- lib/slack_bot/args.rb,
sig/slack_bot.rbs
Instance Attribute Summary collapse
-
#args ⇒ Hash[String, untyped]
Returns the value of attribute args.
-
#raw_args ⇒ Object
Returns the value of attribute raw_args.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ void
- #except(*keys) ⇒ Args
-
#initialize(builder: ArgsBuilder, parser: ArgsParser) ⇒ Args
constructor
A new instance of Args.
- #merge(**other_args) ⇒ Args
- #to_s ⇒ String
Constructor Details
#initialize(builder: ArgsBuilder, parser: ArgsParser) ⇒ Args
Returns a new instance of Args.
28 29 30 31 32 |
# File 'lib/slack_bot/args.rb', line 28 def initialize(builder: ArgsBuilder, parser: ArgsParser) @args = {} @builder = builder @parser = parser end |
Instance Attribute Details
#args ⇒ Hash[String, untyped]
Returns the value of attribute args.
27 28 29 |
# File 'lib/slack_bot/args.rb', line 27 def args @args end |
#raw_args ⇒ Object
Returns the value of attribute raw_args.
47 48 49 |
# File 'lib/slack_bot/args.rb', line 47 def raw_args @raw_args end |
Instance Method Details
#[](key) ⇒ Object
34 35 36 |
# File 'lib/slack_bot/args.rb', line 34 def [](key) args[key] end |
#[]=(key, value) ⇒ void
This method returns an undefined value.
38 39 40 |
# File 'lib/slack_bot/args.rb', line 38 def []=(key, value) args[key] = value end |
#except(*keys) ⇒ Args
59 60 61 62 63 |
# File 'lib/slack_bot/args.rb', line 59 def except(*keys) self.class.new.tap do |new_args| new_args.args = args.except(*keys) end end |
#merge(**other_args) ⇒ Args
53 54 55 56 57 |
# File 'lib/slack_bot/args.rb', line 53 def merge(**other_args) self.class.new.tap do |new_args| new_args.args = args.merge(other_args) end end |
#to_s ⇒ String
49 50 51 |
# File 'lib/slack_bot/args.rb', line 49 def to_s @builder.new(args).call end |