Class: Moblues::Reader::Model
- Inherits:
-
Object
- Object
- Moblues::Reader::Model
- Defined in:
- lib/moblues/reader/model.rb
Instance Method Summary collapse
-
#initialize(params = defaults) ⇒ Model
constructor
A new instance of Model.
- #model(path) ⇒ Object
Constructor Details
#initialize(params = defaults) ⇒ Model
Returns a new instance of Model.
8 9 10 11 |
# File 'lib/moblues/reader/model.rb', line 8 def initialize(params = defaults) @model_resolver = params[:resolver] @entity_reader = params[:reader] end |
Instance Method Details
#model(path) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/moblues/reader/model.rb', line 13 def model(path) raise ArgumentError unless path content_path = model_resolver.resolve_model(path) xml = REXML::Document.new(File.read(content_path)) xml.root.elements.to_a('entity').map { |entity| entity_reader.entity(entity) } end |