Module: EhbrsRubyUtils::Booking::Parsers::List::NodeParserExtra
- Defined in:
- lib/ehbrs_ruby_utils/booking/parsers/list.rb
Constant Summary collapse
- DISTANCE_PARSER =
/\A(\d+)(?:,(\d+))? (m|km)/.to_parser do |m| r = m[1].to_f + m[2].if_present(0) { |v| v.to_f / 10.pow(v.length) } r /= 1000 if m[3] == 'm' r end
Instance Method Summary collapse
Instance Method Details
#distance_value(node, xpath) ⇒ Object
56 57 58 59 |
# File 'lib/ehbrs_ruby_utils/booking/parsers/list.rb', line 56 def distance_value(node, xpath) s = string_value(node, xpath) DISTANCE_PARSER.parse!(s) end |