recordx 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d500fdf1433d2c67abc58827d6bebe8c0691c0ed
4
- data.tar.gz: c2cec89472de04fa5313a45d8bce0a23cecd13c5
3
+ metadata.gz: 3da1ee904c5e41588891e75de5ac4291d02c4abc
4
+ data.tar.gz: 7e013040c055e6ea006421c9bc2c0d8db6eaf689
5
5
  SHA512:
6
- metadata.gz: ab3dd11f8bbe80bfeeda1f298e0743534c83fcdf9c7c554fe862182518a295bf5fde93c85469e157d69adf74957d98741e8520cf70504856e859cb38e463b2a6
7
- data.tar.gz: f6eae2e23f4b7807bce3c48e0d5fe8c7afb0e9ef35bd0d51325c27d424382d9fb7a6020ff2bcf3a5d6049d0cef64314b4b34b9abe2ad931948a470904ed5b004
6
+ metadata.gz: 76e18495b8d3a76f9d8050e6f9b3752b4b6321b943a91db318a8bef6449cd51c95f3346785d4ffab4383876f245de2cb721e5d233d5a7dc19fc731ef4e5e3242
7
+ data.tar.gz: e8f622ca7bdbb09ba5d9b9d204147ac1b475a5d9bd5053ead96fea83049d248281b1526b38f4f8cfcd3211d4af5fd4509b06e28b66a9813cfaac04d8e50d4255
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/recordx.rb CHANGED
@@ -116,6 +116,7 @@ class RecordX
116
116
  def method_missing(method_name, *raw_args)
117
117
 
118
118
  arg = raw_args.length > 0 ? raw_args.first : nil
119
+
119
120
  attr_accessor2(method_name[/\w+/], arg)
120
121
  arg ? self.send(method_name, arg) : self.send(method_name)
121
122
  end
@@ -129,7 +130,7 @@ class RecordX
129
130
  )
130
131
  exceptions = [:name, :id]
131
132
 
132
- if (reserved_keywords - exceptions).include? name.to_sym then
133
+ if (reserved_keywords - exceptions - @h.keys).include? name.to_sym then
133
134
  raise "recordx: reserved keyword *#{name}* can't be used as a field name"
134
135
  end
135
136
 
@@ -138,17 +139,23 @@ class RecordX
138
139
  def #{name}=(s)
139
140
  @#{name} = s.to_s
140
141
  unless @h[:#{name}] == s.to_s then
141
- @h[:#{name}] = s.to_s
142
+ @h[:#{name}] = s.to_s
142
143
  @callerx.update(@id, #{name}: s.to_s) if @callerx
143
144
  end
144
145
  end
145
146
 
146
- def #{name}()
147
- @#{name}
148
- end
149
-
150
147
  }
151
148
 
149
+ # If this method has been monkey patched don't attempt to overwrite it
150
+
151
+ if not self.public_methods.include? name.to_sym then
152
+ self.instance_eval %Q{
153
+ def #{name}()
154
+ @#{name}
155
+ end
156
+ }
157
+ end
158
+
152
159
  self.method((name + '=').to_sym).call val if val
153
160
 
154
161
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recordx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  bXo83lS7MLEbUiv1/KEkh2Mod/KaIQk1LpBtZeQjdIct61KOrmm3PkwFTiDDwsck
32
32
  KUOKoGhzHfhCZw==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-03-10 00:00:00.000000000 Z
34
+ date: 2016-07-22 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexle
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.4.8
83
+ rubygems_version: 2.5.1
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: A kind of Hash which can also use accessor methods to store or retrieve values.
metadata.gz.sig CHANGED
Binary file