Module: Craig::Node::Price

Included in:
Listing::ForSale, Listing::Housing
Defined in:
lib/craig/node.rb

Instance Method Summary collapse

Instance Method Details

#priceInt

Price coerced to 0 if missing.

Returns:

  • (Int)

    price



142
143
144
145
146
147
148
# File 'lib/craig/node.rb', line 142

def price
  dom.elements
    .reverse
    .map(&:text)
    .join("")[/(\$)(\d+)/, 2]
    .to_i
end