In Files

Parent

Included Modules

Class Index [+]

Quicksearch

Rask::Task

Authors:mewlist / Hidenori Doi
Copyright:Copyright (C) 2010 mewlist / Hidenori Doi
License:The MIT License

Task base class

To define new Task you must inherit this base-class

sample code

   class NewTask < Rask::Task
     define_state :initial, :initial => true
     define_state :finish
     def initial
       transition_to_finish
     end
     def finish
       destroy
     end
   end

Attributes

task_id[RW]
group[RW]
state[R]

Public Class Methods

new(_group=nil) click to toggle source
_group
group name to classify. You can filter task group when call Rask::task_ids / Rask::daemon methods.

If group option is given, the task is classified by group name.

sample code

 Rask::insert NewTask.new('group_name')
 Rask::daemon(:group => 'group_name')
# File lib/rask.rb, line 87
    def initialize(_group=nil)
      self.group = _group
      super()
    end

Public Instance Methods

destroy() click to toggle source
# File lib/rask.rb, line 120
    def destroy
      transition nil
    end
destroy?() click to toggle source
# File lib/rask.rb, line 125
    def destroy?
      @state == nil
    end
read_only() click to toggle source
# File lib/rask.rb, line 110
    def read_only
      @read_only = true
    end
read_only?() click to toggle source
# File lib/rask.rb, line 115
    def read_only?
      @read_only == true
    end
run() click to toggle source

automatically callbacked from task engine.

# File lib/rask.rb, line 95
    def run
      return if read_only?
      if @state
        eval @state.to_s
      end
    end
transition(to) click to toggle source

Transition to new state. In the state function.

Usually you should call generated transition_to_[state name] function

# File lib/rask.rb, line 105
    def transition(to)
      @state = to
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.