simple_model 1.2.24 → 1.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDEzYmZjZjIzM2Q1NDM0OTdkYWVkMmNhZDAzOGViMWZiZThkMjdmNg==
4
+ MDRhM2I3NjM1YThmYzJkOTU5YzNlMTVkNjVmMDE3Y2E4OGRmOTMzOQ==
5
5
  data.tar.gz: !binary |-
6
- NmRhN2Q3MmVkNTFhMWE2NmVjNzMxMmFhN2YyYTE1NjgyMmIzZjdjZg==
6
+ ZmRjNDE4M2MyZTI2M2VmZDQwNTczNmFjMjc5MGFiYmY2NmViYTc2MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWQzZmYyZDRlNGU1MGU2OTJhYjM2MjA5NzMxZWM1MDM1ZTY1Yjg1YTk0YmI3
10
- NmYxNGM4YTIwNDI2MWRmNmMzNjAwZDdiMmM1OWU0NjBjOTc1NDI4N2UxOTJh
11
- YmZjOTk1NmYyMmUzNjlkZWQxYmNiYTFiNTNjZTc1N2EwNmJkMTI=
9
+ NjNmMDVjYzIzYTcxMzUwYzFlZjcwNzgxYzgyZjU0NTg1ODk5NTZhYWM5OTJk
10
+ NmE5ZGU1ZDAxZDBhMmNjZDU1NmE3YzcwMzRiZWM3OGFjMGVjMTY3YTQwM2M1
11
+ ZDc1ZjI4ZDAwMGZmYWM3NWJmNmQwODZlZDc0ODBiNDFhYTEwN2E=
12
12
  data.tar.gz: !binary |-
13
- MWM1Zjc4ZTljOGE5MWM2MGUxMjViNTYzZjE3ZWZiNzgwYjc5YWFmNTI2MDNi
14
- ZjJjMzE2YjgxMmYzNmMzYWVlOGVkMzRiMTcwNjFlMWVkMDgxNDc1MzU0YmU3
15
- NjY1NWQ1N2U5Y2Y0YjE1YWJkZWM2OGFiZDRiYjgwM2IzM2NlYTQ=
13
+ MDM4NTljY2IzOTRlNmVjMmZkNTM1NzJjNmI0NzA2Njc0OWVmMDBmMjlmMTk3
14
+ YTczZTJjOGQ2ODQ0OTMxMWEwOTc5MzAyM2JkMjYxNDFlZWQ1MzY0Mjk3OTBh
15
+ NTU2ZmU3NDlmMWJjYjRiNWM4MmIyZDJiZDYwNDY0ZDUxZjljZDU=
@@ -19,7 +19,7 @@ Benchmark.bm do |b|
19
19
  BenchClass.new(:num => 1, :dec => "12.4")
20
20
  end
21
21
  end
22
-
22
+
23
23
  b.report("get") do
24
24
  30000.times.each do
25
25
  klass = BenchClass.new
data/gemfiles/4.2.gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'activesupport','~> 4.2.0.rc1'
4
- gem 'activemodel','~> 4.2.0.rc1'
3
+ gem 'activesupport','~> 4.2.0.rc3'
4
+ gem 'activemodel','~> 4.2.0.rc3'
5
5
 
6
6
  gemspec :path => "../"
@@ -61,13 +61,13 @@ module SimpleModel
61
61
  end
62
62
 
63
63
  def get_attribute?(attr)
64
- val = get_attribute(attr)
64
+ return false unless val = get_attribute(attr)
65
65
  if val.respond_to?(:blank?)
66
66
  return !val.blank?
67
67
  elsif val.respond_to?(:to_b)
68
68
  return val.to_b
69
69
  end
70
- val
70
+ !val.nil?
71
71
  end
72
72
 
73
73
  private
@@ -247,7 +247,7 @@ module SimpleModel
247
247
  define_method(attr) do
248
248
  get_attribute(attr)
249
249
  end
250
- define_method("#{attr.to_s}?") do
250
+ define_method("#{attr}?") do
251
251
  get_attribute?(attr)
252
252
  end
253
253
  end
@@ -256,7 +256,7 @@ module SimpleModel
256
256
  # On set, it will mark the attribute as changed if the attributes has been
257
257
  # initialized.
258
258
  def define_setter_with_options(attr,options)
259
- define_method("#{attr.to_s}=") do |val|
259
+ define_method("#{attr}=") do |val|
260
260
  set_attribute(attr,val)
261
261
  end
262
262
  end
@@ -280,7 +280,7 @@ module SimpleModel
280
280
  define_method("#{new_alias}?") do
281
281
  send("#{attr}?")
282
282
  end
283
- define_method("#{new_alias.to_s}=") do |*args, &block|
283
+ define_method("#{new_alias}=") do |*args, &block|
284
284
  send("#{attr}=",*args, &block)
285
285
  end
286
286
  end
@@ -74,7 +74,7 @@ module SimpleModel
74
74
  # * safe_date_string("\/Date(1310669017000)\/") # =>
75
75
  def safe_datetime_string
76
76
  safe_date = nil
77
- if self[0..9].match(/^(0[1-9]|[1-9]|1[012])[- \/.]([1-9]|0[1-9]|[12][0-9]|3[01])[- \/.][0-9][0-9][0-9][0-9]/)
77
+ if self[0..9] =~ (/^(0[1-9]|[1-9]|1[012])[- \/.]([1-9]|0[1-9]|[12][0-9]|3[01])[- \/.][0-9][0-9][0-9][0-9]/)
78
78
  safe_date = ""
79
79
  splt = split(/\-|\/|\./)
80
80
  time = ""
@@ -86,8 +86,8 @@ module SimpleModel
86
86
  safe_date << "#{splt[2]}-#{splt[0]}-#{splt[1]}"
87
87
  safe_date << "#{time}" unless time.nil? || time.to_s.length == 0
88
88
  end
89
- elsif self.match(/^\/Date\(/)
90
- safe_date = Time.at(((self.gsub(/(\/Date\()/,"")).gsub(/\)\/$/,"").to_f) / 1000).to_s
89
+ elsif self =~ /^\/Date\(/
90
+ safe_date = Time.at(((self.gsub(/(\/Date\()/,"")).gsub(/\)\/$/,"").to_i) / 1000).to_s
91
91
  else
92
92
  safe_date = self
93
93
  end
@@ -97,14 +97,14 @@ module SimpleModel
97
97
  # Use safe_datetime_string help with those pesky US date formats in Ruby 1.9
98
98
  # or to change an integer string to date
99
99
  def to_date
100
- return safe_datetime_string.to_i.to_date if self.match(/^+d$/)
100
+ return safe_datetime_string.to_i.to_date if self =~ /^+d$/
101
101
  Date.parse(safe_datetime_string)
102
102
  end
103
103
 
104
104
  # Use safe_datetime_string help with those pesky US date formats in Ruby 1.9
105
105
  # or to change an integer string to date
106
106
  def to_time
107
- return safe_datetime_string.to_i.to_time if self.match(/^+d$/)
107
+ return safe_datetime_string.to_i.to_time if self =~ /^+d$/
108
108
  Time.parse(safe_datetime_string)
109
109
  end
110
110
 
@@ -1,3 +1,3 @@
1
1
  module SimpleModel
2
- VERSION = "1.2.24"
2
+ VERSION = "1.2.25"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.24
4
+ version: 1.2.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua T Mckinney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-13 00:00:00.000000000 Z
11
+ date: 2014-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport