Class: Ruboty::Handlers::RubyPersistence
- Inherits:
-
Base
- Object
- Base
- Ruboty::Handlers::RubyPersistence
- Defined in:
- lib/ruboty/handlers/ruby_persistence.rb
Constant Summary collapse
- NAMESPACE =
'ruby_persistence'.freeze
Instance Method Summary collapse
Instance Method Details
#set(message) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruboty/handlers/ruby_persistence.rb', line 20 def set() name = [:name] if variables[name] set_and_persist() elsif (method = predefined_method(name)) .reply("Error: `#{name}` is predefined by `#{method.owner}`") else set_and_persist() end end |
#unset(message) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ruboty/handlers/ruby_persistence.rb', line 32 def unset() name = [:name] if variables[name] variables.delete(name) .reply("`#{name}` is now unset") else .reply("Error: No such variable `#{name}`") end end |