Class: Plistr::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/plistr.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#parseObject



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

#valueObject



136
137
138
# File 'lib/plistr.rb', line 136

def value
  @value || parse
end