Module: Aranha::Parsers::Html::Node::Default::NumericSupport
- Defined in:
- lib/aranha/parsers/html/node/default/numeric_support.rb
Instance Method Summary collapse
- #decimal_comma_optional_value(node, xpath) ⇒ Float?
- #decimal_comma_value(node, xpath) ⇒ Float
- #decimal_dot_optional_value(node, xpath) ⇒ Float?
- #decimal_dot_value(node, xpath) ⇒ Float
- #float_optional_value(node, xpath) ⇒ Object
- #float_value(node, xpath) ⇒ Object
- #integer_optional_value(node, xpath) ⇒ Object
- #integer_value(node, xpath) ⇒ Object
-
#us_decimal_optional_value(node, xpath) ⇒ Float?
deprecated
Deprecated.
Use #decimal_dot_optional_value instead.
-
#us_decimal_value(node, xpath) ⇒ Float
deprecated
Deprecated.
Use #decimal_dot_value instead.
Instance Method Details
#decimal_comma_optional_value(node, xpath) ⇒ Float?
22 23 24 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 22 def decimal_comma_optional_value(node, xpath) parse_decimal_comma(node, xpath, false) end |
#decimal_comma_value(node, xpath) ⇒ Float
15 16 17 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 15 def decimal_comma_value(node, xpath) parse_decimal_comma(node, xpath, true) end |
#decimal_dot_optional_value(node, xpath) ⇒ Float?
36 37 38 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 36 def decimal_dot_optional_value(node, xpath) parse_decimal_dot(node, xpath, false) end |
#decimal_dot_value(node, xpath) ⇒ Float
29 30 31 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 29 def decimal_dot_value(node, xpath) parse_decimal_dot(node, xpath, true) end |
#float_optional_value(node, xpath) ⇒ Object
60 61 62 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 60 def float_optional_value(node, xpath) parse_float(node, xpath, false) end |
#float_value(node, xpath) ⇒ Object
56 57 58 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 56 def float_value(node, xpath) parse_float(node, xpath, true) end |
#integer_optional_value(node, xpath) ⇒ Object
50 51 52 53 54 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 50 def integer_optional_value(node, xpath) r = string_value(node, xpath) m = /\d+/.match(r) m ? m[0].to_i : nil end |
#integer_value(node, xpath) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 40 def integer_value(node, xpath) r = string_value(node, xpath) return nil if r.blank? m = /\d+/.match(r) raise "Integer not found in \"#{r}\"" unless m m[0].to_i end |
#us_decimal_optional_value(node, xpath) ⇒ Float?
Deprecated.
Use #decimal_dot_optional_value instead.
76 77 78 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 76 def us_decimal_optional_value(node, xpath) decimal_dot_optional_value(node, xpath) end |
#us_decimal_value(node, xpath) ⇒ Float
Deprecated.
Use #decimal_dot_value instead.
68 69 70 |
# File 'lib/aranha/parsers/html/node/default/numeric_support.rb', line 68 def us_decimal_value(node, xpath) decimal_dot_value(node, xpath) end |