Method: CF::Station.create

Defined in:
lib/cf/station.rb

.create(options, &block) ⇒ Object

Creation of a new station

Usage Example

line = CF::Line.create("Digitize Card","Digitization") do |l|
  CF::InputFormat.new({:line => l, :label => "Company", :required => "true", :valid_type => "general"})
  CF::InputFormat.new({:line => l, :label => "Website", :required => "true", :valid_type => "url"})
  CF::Station.create({:line => l, :type => "work") do |s|
    CF::HumanWorker.new({:station => s, :number => 1, :reward => 20)
    CF::Form.create({:station => s, :title => "Enter text from a business card image", :instruction => "Describe"}) do |i|
      CF::FormField.new({:form => i, :label => "First Name", :field_type => "SA", :required => "true"})
      CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "SA"})
      CF::FormField.new({:form => i, :label => "Last Name", :field_type => "SA", :required => "true"})
    end
  end
end


148
149
150
151
152
153
154
155
156
# File 'lib/cf/station.rb', line 148

def self.create(options, &block)
  station = Station.new(options)
  if block.arity >= 1
    block.call(station)
  else
    station.instance_eval &block
  end
  station
end