Class: SyoboiCalendar::Program
- Inherits:
-
Object
- Object
- SyoboiCalendar::Program
- Defined in:
- lib/syoboi_calendar/program.rb
Constant Summary collapse
- EXT_PARAM_MAP =
(1) :method_name => “NameInSyoboiCalendarResponse” (2) :method_name => [“NameInSyoboiCalendarResponse”, callback]
{ :channel_epg_url => "ChEPGURL", :channel_id => "ChID", :comment => "Comment", :config_flag => "ConfFlag", :count => "Count", :end_time => ["EdTime", proc { |val| Time.at(val.to_i) }], :start_time => ["StTime", proc { |val| Time.at(val.to_i) }], :subtitle => "SubTitle", :subtitle2 => "SubTitle2" }
Instance Attribute Summary collapse
-
#channel_name ⇒ Object
readonly
Returns the value of attribute channel_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#tid ⇒ Object
readonly
Returns the value of attribute tid.
Instance Method Summary collapse
-
#initialize(args) ⇒ Program
constructor
NOTICE: @blob is empty hash at first For example, If self.start_time is called, then update_detail is called automatically, and @blob is updated to fill up @blob.
-
#saisoku? ⇒ Boolean
SAISOKU means “the most earliest broadcasting in the World”.
- #title ⇒ Object
-
#update_detail ⇒ Object
update params from detail data.
Constructor Details
#initialize(args) ⇒ Program
NOTICE: @blob is empty hash at first For example,
If self.start_time is called,
then update_detail is called automatically,
and @blob is updated to fill up @blob[:start_time]
40 41 42 43 44 45 46 |
# File 'lib/syoboi_calendar/program.rb', line 40 def initialize(args) @pid = args[:pid] @tid = args[:tid] @name = args[:name] @channel_name = args[:channel_name] @blob = {} end |
Instance Attribute Details
#channel_name ⇒ Object (readonly)
Returns the value of attribute channel_name.
3 4 5 |
# File 'lib/syoboi_calendar/program.rb', line 3 def channel_name @channel_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/syoboi_calendar/program.rb', line 3 def name @name end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
3 4 5 |
# File 'lib/syoboi_calendar/program.rb', line 3 def pid @pid end |
#tid ⇒ Object (readonly)
Returns the value of attribute tid.
3 4 5 |
# File 'lib/syoboi_calendar/program.rb', line 3 def tid @tid end |
Instance Method Details
#saisoku? ⇒ Boolean
SAISOKU means “the most earliest broadcasting in the World”
49 50 51 |
# File 'lib/syoboi_calendar/program.rb', line 49 def saisoku? !!title.first_channel.match(channel_name) end |
#title ⇒ Object
65 66 67 |
# File 'lib/syoboi_calendar/program.rb', line 65 def title @title ||= Title.new(:tid => @tid) end |
#update_detail ⇒ Object
update params from detail data
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/syoboi_calendar/program.rb', line 54 def update_detail hash = get_detail EXT_PARAM_MAP.each do |k, v| if v.kind_of?(Array) @blob[k] = v[1].call(hash[v[0]]) else @blob[k] = hash[v] end end end |