Module: Craig::Node::Bedrooms

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

Instance Method Summary collapse

Instance Method Details

#bedroomsInt

Returns number of bedrooms.

Returns:

  • (Int)

    number of bedrooms



131
132
133
134
135
# File 'lib/craig/node.rb', line 131

def bedrooms
  node = dom.at_css(".itemph")
  return nil unless node
  node.text[/\d+(?=br)/].to_i
end