recordx 0.1.15 → 0.1.16

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: 632f800ab1d6c0e67d1c691d81fd9229dc61f915
4
- data.tar.gz: a40f1f9abcfd50cb6deedd68c15d1ffa58e5c93a
3
+ metadata.gz: fb38104cb38491761b5fdf8d3ee8032cda26ca34
4
+ data.tar.gz: 75e2db97795497d4cca70002476e34332c78e648
5
5
  SHA512:
6
- metadata.gz: 59117baa7d78fc6a97512350c495eccfec7ddad34600f4c9fab1595fac47d4b4dc4b0d01a9143d74d56d62497d730c86742b462371d3b50b1403997c79988c86
7
- data.tar.gz: 055c54a602a08001afcfb12650f97f97e3c0b4a9ab60e39c22e32752c1e7d83f956fb128f4b1cd3d07402b6f72f688eeb25b436f46febf713eb7bf04b960ae0e
6
+ metadata.gz: d132a9afee98e3eb86a5510b102225a7e90039a955792eb77ff95985daecc99aa42df0c57633d516d6cf115fb82564cb9b8e9d162fc12a31243a88100d37ce63
7
+ data.tar.gz: 0483b831e509ffa399c9952b4c7bb791cc59ece280b6d83d1bc237c057e9c2a3a302fe52f2cf818bd5c523dc302fb7d2e6078d709cabee16cbb7e5181bacb8a6
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/recordx.rb CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  # file: recordx.rb
4
4
 
5
+
5
6
  class RecordX
6
7
 
7
8
  attr_reader :id
8
9
 
9
10
  class RXHash < Hash
11
+
10
12
  def initialize(callerx)
11
13
  super()
12
14
  @callerx = callerx
@@ -20,8 +22,16 @@ class RecordX
20
22
  end
21
23
  end
22
24
 
23
- def initialize(h={}, callerx=nil, id=nil )
25
+ def initialize(x=nil, callerx=nil, id=nil )
24
26
 
27
+ h = if x.is_a? Hash then
28
+ x
29
+ elsif x.is_a? Array and x.first.is_a? Rexle::Element then
30
+ x.inject({}) {|r,y| r.merge(y.name.to_sym => y.text.unescape)}
31
+ else
32
+ x
33
+ end
34
+
25
35
  @callerx, @id = callerx, id
26
36
  @h = RXHash.new(self).merge h
27
37
  h.each {|name,val| attr_accessor2(name.to_s, val) }
@@ -43,7 +53,7 @@ class RecordX
43
53
  end
44
54
 
45
55
  def inspect()
46
- "<object #%s>" % [self.object_id]
56
+ "#<RecordX:%s>" % [self.object_id]
47
57
  end
48
58
 
49
59
  alias to_h h
data.tar.gz.sig CHANGED
Binary file
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.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file