Class: Ripdiru::Program

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Program

Returns a new instance of Program.



125
126
127
128
129
# File 'lib/ripdiru.rb', line 125

def initialize(args = {})
  args.each do |k, v|
    send "#{k}=", v
  end
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



124
125
126
# File 'lib/ripdiru.rb', line 124

def duration
  @duration
end

#fromObject

Returns the value of attribute from.



124
125
126
# File 'lib/ripdiru.rb', line 124

def from
  @from
end

#idObject

Returns the value of attribute id.



124
125
126
# File 'lib/ripdiru.rb', line 124

def id
  @id
end

#infoObject

Returns the value of attribute info.



124
125
126
# File 'lib/ripdiru.rb', line 124

def info
  @info
end

#stationObject

Returns the value of attribute station.



124
125
126
# File 'lib/ripdiru.rb', line 124

def station
  @station
end

#titleObject

Returns the value of attribute title.



124
125
126
# File 'lib/ripdiru.rb', line 124

def title
  @title
end

#toObject

Returns the value of attribute to.



124
125
126
# File 'lib/ripdiru.rb', line 124

def to
  @to
end

Instance Method Details

#effective_dateObject



131
132
133
134
# File 'lib/ripdiru.rb', line 131

def effective_date
  time = from.hour < 5 ? from - 24 * 60 * 60 : from
  Date.new(time.year, time.month, time.day)
end

#recording_durationObject



136
137
138
# File 'lib/ripdiru.rb', line 136

def recording_duration
  (to - Time.now).to_i
end