lib/fsr/model/agent.rb in freeswitcher-0.5.4 vs lib/fsr/model/agent.rb in freeswitcher-0.5.5
- old
+ new
@@ -1,18 +1,18 @@
-require_relative "../model"
+require 'ostruct'
module FSR
module Model
- class Agent
- attr_reader :fields, :extension, :full_name
- include FSR::Model
+ class Agent < OpenStruct
+ attr_accessor :extension, :full_name
- def initialize(headers, *data)
- @fields = headers
- @fields.each_with_index do |h,i|
- (class << self; self; end).send(:define_method,h.to_sym) { data[i] }
- end
-
+ def initialize(fields, *data)
+ super(Hash[fields.zip(data)])
@extension, @full_name = name.split("-", 2)
end
+
+ def fields
+ raise NotImplementedError, "This class is now an OpenStruct"
+ end
+
end
end
end