lib/slack-ruby-bot/config.rb in slack-ruby-bot-0.6.0 vs lib/slack-ruby-bot/config.rb in slack-ruby-bot-0.6.1

- old
+ new

@@ -1,25 +1,22 @@ module SlackRubyBot module Config extend self - attr_accessor :token - attr_accessor :url - attr_accessor :aliases - attr_accessor :user - attr_accessor :user_id - attr_accessor :team - attr_accessor :team_id - attr_accessor :allow_message_loops - attr_accessor :send_gifs + ATTRS = [:token, :url, :aliases, :user, :user_id, :team, :team_id, :allow_message_loops, :send_gifs].freeze + attr_accessor(*ATTRS) def allow_message_loops? allow_message_loops end def send_gifs? v = boolean_from_env('SLACK_RUBY_BOT_SEND_GIFS') v.nil? ? (send_gifs.nil? || send_gifs) : v + end + + def reset! + ATTRS.each { |attr| send("#{attr}=", nil) } end private def boolean_from_env(key)