ford 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/ford/stage.rb +16 -16
  2. data/lib/ford/version.rb +1 -1
  3. metadata +2 -2
@@ -24,7 +24,7 @@ module Ford
24
24
  #
25
25
  class Stage
26
26
 
27
- attr_accessor :config, :logger, :input
27
+ attr_accessor :config, :logger, :item
28
28
 
29
29
  #
30
30
  # Create a queue for each Stage subclass
@@ -62,7 +62,7 @@ module Ford
62
62
  obj.run
63
63
  rescue Exception => exc
64
64
  obj.logger.fatal("\nFailed to execute the #{self.class}'s thread (#{tid})")
65
- obj.logger.fatal("was consuming: #{obj.input}")
65
+ obj.logger.fatal("was consuming: #{obj.item}")
66
66
  obj.logger.fatal("#{exc}\n#{exc.backtrace.join("\n")}")
67
67
  end
68
68
  }
@@ -81,7 +81,7 @@ module Ford
81
81
  data = {
82
82
  :debug => false, # If true, logs messages during execution
83
83
  :log_to => STDOUT, # Logging path or IO instance
84
- :input_stage => self.class # Reference to the input Stage (normally, itself). Will load objs from its queue.
84
+ :from_stage => self.class # Reference of the Stage that is used as data input (normally, itself). Will load items from its queue.
85
85
  }.merge(options)
86
86
 
87
87
  @config = Ford::Config.new(data) # instance configuration
@@ -93,43 +93,43 @@ module Ford
93
93
  # Run the stage
94
94
  #
95
95
  def run
96
- while (@input = pop_input)
96
+ while (@item = pop_item)
97
97
  start_consume_at = Time.now
98
98
 
99
99
  logger.debug("Consuming...(#{config.thread_id})")
100
- consume_input
100
+ consume
101
101
 
102
102
  logger.debug("Consumed in #{Time.now - start_consume_at} seconds (#{config.thread_id})")
103
103
  end
104
104
  end
105
105
 
106
106
  #
107
- # When using the default run, consume_input should be implemented.
107
+ # When using the default run, consume should be implemented.
108
108
  #
109
- def consume_input
109
+ def consume
110
110
  raise 'Must implement!'
111
111
  end
112
112
 
113
113
  #
114
- # Pop an object from the input queue
114
+ # Pop an item from the queue
115
115
  #
116
- def pop_input
117
- @config.input_stage.queue.pop
116
+ def pop_item
117
+ @config.from_stage.queue.pop
118
118
  end
119
119
 
120
120
  #
121
- # Enqueue an object in the stage's queue
121
+ # Enqueue an item in the stage's queue
122
122
  #
123
- def enqueue_to(stage_class, obj)
124
- stage_class.queue.push obj
123
+ def send_to(stage_class, item)
124
+ stage_class.queue.push item
125
125
  logger.debug("Enqueued into #{stage_class}'s queue (#{config.thread_id})")
126
126
  end
127
127
 
128
128
  #
129
- # Enqueue an object in the current stage's queue
129
+ # Enqueue an item in the current stage's queue
130
130
  #
131
- def enqueue_back(obj)
132
- self.class.queue.push obj
131
+ def send_back(item)
132
+ self.class.queue.push item
133
133
  logger.debug("Enqueued back (#{config.thread_id})")
134
134
  end
135
135
 
@@ -1,3 +1,3 @@
1
1
  module Ford
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ford
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Bruno Bueno
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-07-11 00:00:00 -03:00
16
+ date: 2011-07-18 00:00:00 -03:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency