Skip to content

Commit

Permalink
Rubocop: Lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Jan 10, 2017
1 parent ad93cb1 commit 6db4ba5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/models/polymorphic/comment.rb
Expand Up @@ -23,7 +23,7 @@ class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :commentable, polymorphic: true

scope :created_by, lambda { |user| where(user_id: user.id) }
scope :created_by, ->(user) { where(user_id: user.id) }

validates_presence_of :user, :commentable, :comment
has_paper_trail class_name: 'Version', meta: { related: :commentable },
Expand Down
8 changes: 4 additions & 4 deletions app/models/polymorphic/version.rb
Expand Up @@ -13,10 +13,10 @@ class Version < PaperTrail::Version
belongs_to :related, polymorphic: true
belongs_to :user, foreign_key: :whodunnit

scope :default_order, lambda { order('created_at DESC') }
scope :include_events, lambda { |*events| where(event: events) }
scope :exclude_events, lambda { |*events| where('event NOT IN (?)', events) }
scope :for, lambda { |user| where(whodunnit: user.id.to_s) }
scope :default_order, -> { order('created_at DESC') }
scope :include_events, ->(*events) { where(event: events) }
scope :exclude_events, ->(*events) { where('event NOT IN (?)', events) }
scope :for, ->(user) { where(whodunnit: user.id.to_s) }

class << self
def recent_for_user(user, limit = 10)
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/simple_form.rb
Expand Up @@ -57,7 +57,7 @@
# config.collection_value_methods = [ :id, :to_s ]

# How the label text should be generated altogether with the required text.
config.label_text = lambda { |label, _required, _explicit_label| "#{label}" }
config.label_text = ->(label, _required, _explicit_label) { "#{label}" }

# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
Expand Down
8 changes: 4 additions & 4 deletions config/locales/th.rb
Expand Up @@ -41,9 +41,9 @@ module ThaiLocaleI18n

date: {
formats: {
default: lambda { |date, _opts| "%d-%m-#{date.year + 543}" },
default: ->(date, _opts) { "%d-%m-#{date.year + 543}" },
short: "%d %b",
long: lambda { |date, _opts| "%d %B #{date.year + 543}" }
long: ->(date, _opts) { "%d %B #{date.year + 543}" }
},

day_names: %w(อาทิตย์ จันทร์ อังคาร พุธ พฤหัสบดี ศุกร์ เสาร์),
Expand All @@ -56,9 +56,9 @@ module ThaiLocaleI18n

time: {
formats: {
default: lambda { |date, _opts| "%a %d %b #{date.year + 543} %H:%M:%S %z" },
default: ->(date, _opts) { "%a %d %b #{date.year + 543} %H:%M:%S %z" },
short: "%d %b %H:%M น.",
long: lambda { |date, _opts| "%d %B #{date.year + 543} %H:%M น." }
long: ->(date, _opts) { "%d %B #{date.year + 543} %H:%M น." }
},
am: "ก่อนเที่ยง",
pm: "หลังเที่ยง"
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/ffcrm/setup.rake
Expand Up @@ -42,7 +42,7 @@ namespace :ffcrm do

password ||= "manager"
print "Password [#{password}]: "
echo = lambda { |toggle| return if RUBY_PLATFORM =~ /mswin/; system(toggle ? "stty echo && echo" : "stty -echo") }
echo = ->(toggle) { return if RUBY_PLATFORM =~ /mswin/; system(toggle ? "stty echo && echo" : "stty -echo") }
begin
echo.call(false)
reply = STDIN.gets.strip
Expand Down

0 comments on commit 6db4ba5

Please sign in to comment.