Sha256: 1f51de57211c4a2769d0627d9697dd12ed83072c0ce7606722cdaec5774f9533
Contents?: true
Size: 753 Bytes
Versions: 2
Compression:
Stored size: 753 Bytes
Contents
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) require File.join(dir, 'happymapper') file_contents = File.read(dir + '/../spec/fixtures/current_weather.xml') class CurrentWeather include HappyMapper tag 'ob' element :temperature, Integer, :tag => 'temp' element :feels_like, Integer, :tag => 'feels-like' element :current_condition, String, :tag => 'current-condition', :attributes => {:icon => String} end CurrentWeather.parse(file_contents).each do |current_weather| puts "temperature: #{current_weather.temperature}" puts "feels_like: #{current_weather.feels_like}" puts "current_condition: #{current_weather.current_condition}" puts "current_condition.icon: #{current_weather.current_condition.icon}" end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
jnunemaker-happymapper-0.2.0 | examples/current_weather.rb |
happymapper-0.2.0 | examples/current_weather.rb |