Clean up trailing and leading whitespace

This commit is contained in:
James Espinosa
2014-07-05 19:15:32 -05:00
parent 6ea16fbe18
commit 68e6a01743
75 changed files with 499 additions and 499 deletions
+7 -7
View File
@@ -1,6 +1,6 @@
class Benefits < ActiveRecord::Base
attr_accessor :backup
def self.save(file, backup=false)
data_path = Rails.root.join("public", "data")
full_file_name = "#{data_path}/#{file.original_filename}"
@@ -9,18 +9,18 @@ class Benefits < ActiveRecord::Base
f.close
make_backup(file, data_path, full_file_name) if backup == "true"
end
def self.make_backup(file, data_path, full_file_name)
if File.exists?(full_file_name)
if File.exists?(full_file_name)
silence_streams(STDERR) { system("cp #{full_file_name} #{data_path}/bak#{Time.now.to_i}_#{file.original_filename}") }
end
end
end
=begin
=begin
def self.make_backup(file, data_path, full_file_name)
FileUtils.cp "#{full_file_name}", "#{data_path}/bak#{Time.now.to_i}_#{file.original_filename}"
end
=end
=end
def self.silence_streams(*streams)
on_hold = streams.collect { |stream| stream.dup }
@@ -34,5 +34,5 @@ class Benefits < ActiveRecord::Base
stream.reopen(on_hold[i])
end
end
end
+1 -1
View File
@@ -2,5 +2,5 @@ class KeyManagement < ActiveRecord::Base
attr_accessible :iv, :user_id
belongs_to :work_info
belongs_to :user
end
+2 -2
View File
@@ -6,11 +6,11 @@ class PaidTimeOff < ActiveRecord::Base
def sick_days_remaining
self.sick_days_earned - self.sick_days_taken
end
def pto_days_remaining
self.pto_earned - self.pto_taken
end
def sick_days_taken_percentage
result = self.sick_days_taken.to_f / self.sick_days_earned.to_f * 100.0
end
+8 -8
View File
@@ -1,25 +1,25 @@
class Pay < ActiveRecord::Base
# mass-assignable attributes
attr_accessible :bank_account_num, :bank_routing_num, :percent_of_deposit
# Associations
belongs_to :user
belongs_to :user
# Validations
validates :bank_account_num, presence: true
validates :bank_routing_num, presence: true
validates :percent_of_deposit, presence: true
# callbacks
before_save :encrypt_bank_account_num
def as_json
super(only: [:bank_account_num, :bank_routing_num, :percent_of_deposit, :id])
end
def encrypt_bank_account_num
self.bank_account_num = Encryption.encrypt_sensitive_value(self.bank_account_num)
end
end
+2 -2
View File
@@ -1,7 +1,7 @@
class Performance < ActiveRecord::Base
attr_accessible :comments, :date_submitted, :reviewer, :score
belongs_to :user
belongs_to :user
def reviewer_name
u = User.find_by_id(self.reviewer)
u.full_name if u.respond_to?('fullname')
+1 -1
View File
@@ -1,6 +1,6 @@
class Schedule < ActiveRecord::Base
attr_accessible :date_begin, :date_end, :event_desc, :event_name, :event_type
belongs_to :paid_time_off
validates_presence_of :date_begin, :date_end, :event_desc, :event_name, :event_type
end
+10 -10
View File
@@ -13,7 +13,7 @@ class User < ActiveRecord::Base
:confirmation => true,
:if => :password,
:format => {:with => /\A.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\@\#\$\%\^\&\+\=]).*\z/}
=end
=end
validates_presence_of :email
validates_uniqueness_of :email
validates_format_of :email, :with => /.+@.+\..+/i
@@ -37,11 +37,11 @@ class User < ActiveRecord::Base
#work_info.build_key_management(:iv => SecureRandom.hex(32))
performance.build(POPULATE_PERFORMANCE.shuffle.first)
end
def full_name
"#{self.first_name} #{self.last_name}"
end
=begin
# Instead of the entire user object being returned, we can use this to filter.
def as_json
@@ -59,10 +59,10 @@ private
auth = user
else
raise "Incorrect Password!"
end
end
return auth
end
end
=begin
# More secure version, still lacking a decent hashing routine, this is for timing attack prevention
def self.authenticate(email, password)
@@ -71,9 +71,9 @@ private
return user
else
raise "Incorrect username or password"
end
end
end
=end
=end
def assign_user_id
unless @skip_user_id_assign.present? || self.user_id.present?
@@ -82,7 +82,7 @@ private
self.user_id = uid.to_s if uid
end
end
def hash_password
unless @skip_hash_password == true
if password.present?
@@ -90,7 +90,7 @@ private
end
end
end
def generate_token(column)
begin
self[column] = Encryption.encrypt_sensitive_value(self.user_id)
+8 -8
View File
@@ -3,13 +3,13 @@ class WorkInfo < ActiveRecord::Base
belongs_to :user
has_one :key_management, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
#before_save :encrypt_ssn
# We should probably use this
def last_four
"***-**-" << self.decrypt_ssn[-4,4]
end
def encrypt_ssn
aes = OpenSSL::Cipher::Cipher.new(cipher_type)
aes.encrypt
@@ -18,7 +18,7 @@ class WorkInfo < ActiveRecord::Base
self.encrypted_ssn = aes.update(self.SSN) + aes.final
self.SSN = nil
end
def decrypt_ssn
aes = OpenSSL::Cipher::Cipher.new(cipher_type)
aes.decrypt
@@ -26,19 +26,19 @@ class WorkInfo < ActiveRecord::Base
aes.iv = iv if iv != nil
aes.update(self.encrypted_ssn) + aes.final
end
def key
raise "Key Missing" if !(KEY)
KEY
end
def iv
raise "No IV for this User" if !(self.key_management.iv)
self.key_management.iv
end
def cipher_type
'aes-256-cbc'
end
end