class Syobocalite::Program
Attributes
ch_id[RW]
@!attribute ch_id
@return [Integer]
ch_name[RW]
@!attribute ch_name
@return [String]
count[RW]
@!attribute count
@return [Integer]
ed_time[RW]
@!attribute ed_time
@return [ActiveSupport::TimeWithZone]
pid[RW]
@!attribute pid
@return [Integer]
prog_comment[RW]
@!attribute prog_comment
@return [String]
st_offset[RW]
@!attribute st_offset
@return [Integer]
st_time[RW]
@!attribute st_time
@return [ActiveSupport::TimeWithZone]
story_number[RW]
@!attribute count
@return [Integer]
story_number=[RW]
@!attribute count
@return [Integer]
sub_title[RW]
@!attribute sub_title
@return [String]
tid[RW]
@!attribute tid
@return [Integer]
title[RW]
@!attribute title
@return [String]
Public Class Methods
from_prog_item(attrs = {})
click to toggle source
@param attrs [Hash]
@return [Syobocalite::Program]
# File lib/syobocalite/program.rb, line 79 def self.from_prog_item(attrs = {}) Syobocalite::Program.new( pid: attrs["PID"]&.to_i, tid: attrs["TID"]&.to_i, st_time: to_time(attrs["StTime"]), ed_time: to_time(attrs["EdTime"]), ch_name: attrs["ChName"], ch_id: attrs["ChID"]&.to_i, count: attrs["Count"]&.to_i, st_offset: attrs["StOffset"]&.to_i, sub_title: sanitize_text(attrs["SubTitle"]), title: sanitize_text(attrs["Title"]), prog_comment: attrs["ProgComment"]&.gsub(/^!/, ""), ) end
new(pid: nil, tid: nil, st_time: nil, ed_time: nil, ch_name: nil, ch_id: nil, count: nil, st_offset: nil, sub_title: nil, title: nil, prog_comment: nil)
click to toggle source
@param pid [Integer] @param tid [Integer] @param st_time
[ActiveSupport::TimeWithZone] @param ed_time
[ActiveSupport::TimeWithZone] @param ch_name
[String] @param ch_id
[Integer] @param count [Integer] @param st_offset
[Integer] @param sub_title
[String] @param title [String] @param prog_comment
[String]
# File lib/syobocalite/program.rb, line 58 def initialize(pid: nil, tid: nil, st_time: nil, ed_time: nil, ch_name: nil, ch_id: nil, count: nil, st_offset: nil, sub_title: nil, title: nil, prog_comment: nil) @pid = pid @tid = tid @st_time = st_time @ed_time = ed_time @ch_name = ch_name @ch_id = ch_id @count = count @st_offset = st_offset @sub_title = sub_title @title = title @prog_comment = prog_comment end
Private Class Methods
sanitize_text(str)
click to toggle source
# File lib/syobocalite/program.rb, line 104 def self.sanitize_text(str) return nil unless str CGI.unescapeHTML(str) end
to_time(str)
click to toggle source
# File lib/syobocalite/program.rb, line 95 def self.to_time(str) return nil unless str Time.use_zone("Tokyo") do Time.zone.parse(str) end end