Class: SyoboiCalendar::Parsers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/syoboi_calendar/parsers/base.rb

Direct Known Subclasses

Channel, Program, Title

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Base

Returns a new instance of Base.



12
13
14
# File 'lib/syoboi_calendar/parsers/base.rb', line 12

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



10
11
12
# File 'lib/syoboi_calendar/parsers/base.rb', line 10

def response
  @response
end

Class Method Details

.parse(response) ⇒ Object



5
6
7
# File 'lib/syoboi_calendar/parsers/base.rb', line 5

def parse(response)
  new(response).parse
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
# File 'lib/syoboi_calendar/parsers/base.rb', line 16

def parse
  items.map do |item|
    resource_class.new(item)
  end
rescue NoMethodError
  []
end