Class: SlackBot::Session
- Inherits:
-
Object
- Object
- SlackBot::Session
- Defined in:
- lib/slack/session.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, val) ⇒ Object
- #for_channel(id) ⇒ Object
- #for_user(id) ⇒ Object
-
#initialize(team_id, args = {}) ⇒ Session
constructor
A new instance of Session.
- #to_s ⇒ Object
Constructor Details
#initialize(team_id, args = {}) ⇒ Session
Returns a new instance of Session.
3 4 5 6 7 |
# File 'lib/slack/session.rb', line 3 def initialize(team_id, args={}) @user_scoped = Hash.new @channel_scoped = Hash.new @general = Hash.new end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 |
# File 'lib/slack/session.rb', line 9 def [](key) @general[key] end |
#[]=(key, val) ⇒ Object
13 14 15 |
# File 'lib/slack/session.rb', line 13 def []=(key, val) @general[key] = val end |
#for_channel(id) ⇒ Object
21 22 23 |
# File 'lib/slack/session.rb', line 21 def for_channel(id) @channel_scoped[id] ||= Hash.new end |
#for_user(id) ⇒ Object
17 18 19 |
# File 'lib/slack/session.rb', line 17 def for_user(id) @user_scoped[id] ||= Hash.new end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/slack/session.rb', line 25 def to_s @general.to_s end |