Class: Lita::Schedule

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lita/schedule.rb,
lib/lita/schedule/version.rb

Defined Under Namespace

Classes: Job

Constant Summary collapse

VERSION =
"0.0.1"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(robot) ⇒ Schedule

Returns a new instance of Schedule.



22
23
24
25
# File 'lib/lita/schedule.rb', line 22

def initialize(robot)
  @robot = robot
  @redis = Redis::Namespace.new(Lita::REDIS_NAMESPACE, redis: Lita.redis)
end

Instance Attribute Details

#redisObject (readonly)

Returns the value of attribute redis.



7
8
9
# File 'lib/lita/schedule.rb', line 7

def redis
  @redis
end

#robotObject (readonly)

Returns the value of attribute robot.



8
9
10
# File 'lib/lita/schedule.rb', line 8

def robot
  @robot
end

Class Method Details

.cron(cron_field, job_name) ⇒ Object



13
14
15
# File 'lib/lita/schedule.rb', line 13

def cron(cron_field, job_name)
  jobs << Job.new(cron_field, job_name)
end

.jobsObject



17
18
19
# File 'lib/lita/schedule.rb', line 17

def jobs
  @jobs ||= []
end