Commit a60d133

mo <mo.khan@gmail.com>
2018-05-19 15:48:07
fix some rubocop errors.
1 parent d2deadb
Changed files (3)
lib/del/cli.rb
@@ -33,7 +33,10 @@ module Del
 
     desc 'message <jid> <message>', 'send a message to the Jabber ID'
     def message(jid, message)
-      SendMessage.new(self, socket_file: options[:socket_file]).run(jid, message)
+      SendMessage.new(
+        self,
+        socket_file: options[:socket_file]
+      ).run(jid, message)
     end
 
     desc 'whoami', 'send a whoami message to the local del server'
@@ -90,8 +93,11 @@ module Del
     end
 
     def load_settings(additional_settings)
-      settings = YAML.safe_load(IO.read(options[:configuration_file]), symbolize_names: true)
-      if settings[:password].nil? || settings[:password].length == 0
+      settings = YAML.safe_load(
+        IO.read(options[:configuration_file]),
+        symbolize_names: true
+      )
+      if settings[:password].nil? || settings[:password].length.zero?
         settings[:password] = ask('Password:', echo: false)
       end
       settings[:log_level] = options[:log_level]
lib/del/connection.rb
@@ -41,7 +41,11 @@ module Del
         muc.on_message do |_, nickname, message|
           Del.logger.debug([nickname, message].inspect)
           other_jid = roster.items.find { |_jid, item| item.iname == nickname }
-          robot.receive(message, source: Source.new(user: User.new(other_jid[0], other_jid[1]), room: stripped_jid))
+          source = Source.new(
+            user: User.new(other_jid[0], other_jid[1]),
+            room: stripped_jid
+          )
+          robot.receive(message, source: source)
         end
         muc.join(room_jid)
       end
lib/del/robot.rb
@@ -36,7 +36,10 @@ module Del
 
     def execute(request)
       {
-        send_message: -> { send_message(request['jid'], request['message']); 'Sent!' },
+        send_message: lambda do
+          send_message(request['jid'], request['message'])
+          'Sent!'
+        end,
         users: -> { JSON.generate(configuration.users.all.map(&:attributes)) },
         whoami: -> { JSON.generate(whois(jid)) },
         whois: -> { JSON.generate(whois(request['q'])) }