Class: ButterSand::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/butter_sand/parser.rb

Constant Summary collapse

KEY_DATE_INFO =
0
KEY_PREFECTURE =
1
KEY_SHOP_NAME =
2
KEY_PHONE_NUM =
3
KEY_DATE_STARTS =
0
KEY_DATE_ENDS =
1

Class Method Summary collapse

Class Method Details

.to_array(body) ⇒ Array<Hash>

Returns:



19
20
21
22
# File 'lib/butter_sand/parser.rb', line 19

def to_array(body)
  valid_infos = raw_events(Nokogiri::HTML(body)).select { |elem| is_valid_data? elem }
  valid_infos.map { |elem| shop_data_hash(elem.split(/\n\s+/)) }
end