freeswitcher 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,13 @@
1
+ require 'ostruct'
1
2
  module FSR
2
3
  module Model
3
- class Call
4
- attr_reader :fields
5
- def initialize(headers, *data)
6
- @fields = headers
7
- @fields.each_with_index do |h,i|
8
- (class << self; self; end).send(:define_method,h.to_sym) { data[i] }
9
- end
4
+ class Call < OpenStruct
5
+ def initialize(fields, *data)
6
+ super(Hash[fields.zip(data)])
7
+ end
8
+
9
+ def fields
10
+ raise NotImplementedError, "This class is now an OpenStruct"
10
11
  end
11
12
  end
12
13
  end
@@ -1,12 +1,13 @@
1
+ require 'ostruct'
1
2
  module FSR
2
3
  module Model
3
- class Channel
4
- attr_reader :fields
5
- def initialize(headers, *data)
6
- @fields = headers
7
- @fields.each_with_index do |h,i|
8
- (class << self; self; end).send(:define_method,h.to_sym) { data[i] }
9
- end
4
+ class Channel < OpenStruct
5
+ def initialize(fields, *data)
6
+ super(Hash[fields.zip(data)])
7
+ end
8
+
9
+ def fields
10
+ raise NotImplementedError, "This class is now an OpenStruct"
10
11
  end
11
12
  end
12
13
  end
data/lib/fsr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FSR
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 3
9
- version: 0.5.3
8
+ - 4
9
+ version: 0.5.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jayson Vaughn
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-01-30 00:00:00 -06:00
20
+ date: 2011-01-31 00:00:00 -06:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency