Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support for false/nil options accessed through method_missing. Nonfun…

…ctional paste disabling for campfire.
  • Loading branch information...
commit c5d8a6764f832a71592ba62cf8c49a6b716a3f84 1 parent 0fadf58
@jqr jqr authored
Showing with 9 additions and 5 deletions.
  1. +4 −4 lib/snitch/service.rb
  2. +5 −1 lib/snitch/services/campfire.rb
View
8 lib/snitch/service.rb
@@ -7,7 +7,7 @@ def self.new_from_name(s, attributes)
end
def initialize(attributes)
- self.attributes = default_options.merge(attributes || {})
+ self.attributes = default_options.merge(attributes || {}).symbolize_keys
end
def default_options
@@ -15,10 +15,10 @@ def default_options
end
def method_missing(method, *args, &block)
- if method.to_s =~ /=$/
- self.attributes[method.to_s.chop] = args[0]
+ if attributes.include?(method)
+ attributes[method]
else
- attributes[method.to_s] || attributes[method] || super
+ super
end
end
end
View
6 lib/snitch/services/campfire.rb
@@ -9,8 +9,12 @@ def connection
connection.find_or_create_room_by_name(room)
end
+ def default_options
+ super.merge(:paste => true)
+ end
+
def tattle(message)
- connection.paste(message)
+ connection.speak(message, :paste => paste)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.