Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
replacing lambda syntax with 1.9 syntax and sending (unused) variable…
… to prevent borkage
  • Loading branch information
originalpete committed Mar 26, 2013
1 parent a3fc624 commit 379154b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Expand Up @@ -3,10 +3,10 @@ module Connector

class IncrementStatusValueCommand < Sonar::Connector::Command
def initialize(connector, field, value = 1)
l = lambda do
l = ->(_) {
current = status[connector.name] ? status[connector.name][field].to_i : 0
status.set connector.name, field, current+value
end
}
super(l)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/sonar_connector/commands/send_admin_email_command.rb
Expand Up @@ -2,9 +2,9 @@ module Sonar
module Connector
class SendAdminEmailCommand < Sonar::Connector::Command
def initialize(connector, message)
l = lambda do
l = ->(_) {
Sonar::Connector::Emailer.deliver_admin_message(connector, message)
end
}
super(l)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/sonar_connector/commands/update_disk_usage_command.rb
Expand Up @@ -2,10 +2,10 @@ module Sonar
module Connector
class UpdateDiskUsageCommand < Sonar::Connector::Command
def initialize(connector)
l = lambda do
l = ->(_) {
du = (Sonar::Connector::Utils.du(connector.connector_dir).to_f / 1024).round
status.set connector.name, 'disk_usage', "#{du} Kb"
end
}
super(l)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/sonar_connector/commands/update_status_command.rb
Expand Up @@ -6,9 +6,9 @@ module Connector

class UpdateStatusCommand < Sonar::Connector::Command
def initialize(connector, field, value)
l = lambda do
l = ->(_) {
status.set connector.name, field, value
end
}
super(l)
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/sonar_connector/emailer_spec.rb
Expand Up @@ -22,7 +22,8 @@
end

it "should have correct sender" do
@email.from.should == @base_config.email_settings["admin_sender"].to_a
@email.from.size.should == 1
@email.from.first.should == @base_config.email_settings["admin_sender"]
end

it "should have correct recipient" do
Expand Down

0 comments on commit 379154b

Please sign in to comment.