Class: Plistr::Reader
- Inherits:
-
Object
- Object
- Plistr::Reader
- Defined in:
- lib/plistr.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Reader
constructor
A new instance of Reader.
- #parse ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(data) ⇒ Reader
Returns a new instance of Reader.
132 133 134 |
# File 'lib/plistr.rb', line 132 def initialize(data) @data = data end |
Class Method Details
.open(filename) ⇒ Object
127 128 129 130 |
# File 'lib/plistr.rb', line 127 def self.open(filename) data = File.open(filename) new(data) end |
Instance Method Details
#parse ⇒ Object
140 141 142 143 144 145 |
# File 'lib/plistr.rb', line 140 def parse @document = Document.new parser = Nokogiri::XML::SAX::Parser.new(@document) parser.parse(@data) @value = @document.value end |
#value ⇒ Object
136 137 138 |
# File 'lib/plistr.rb', line 136 def value @value || parse end |