Class: Rpa::Runner
- Inherits:
-
Object
- Object
- Rpa::Runner
- Defined in:
- lib/rpa/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#photos ⇒ Object
readonly
Returns the value of attribute photos.
Instance Method Summary collapse
-
#initialize(args) ⇒ Runner
constructor
A new instance of Runner.
- #run! ⇒ Object
Constructor Details
#initialize(args) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rpa/runner.rb', line 9 def initialize(args) @options = Options.new(args).parse!. if @options[:list_themes] puts Rpa.themes.join("\n") exit 0 end [:in_dir] = File.([:in_dir]) @photos = Dir["#{[:in_dir]}/**/*"].select do |f| %x{ file -ib "#{f}" }.to_s.strip.match(/^image/) && PHOTO_TYPES.any? { |t| f.match(/#{t}$/i) } end.sort do |x,y| Util.get_file_creation_time(x) <=> Util.get_file_creation_time(y) end if photos.length == 0 raise "IN_DIR must contain at least one photo." end [:out_dir] = File.([:out_dir]) if File.exists?([:out_dir]) unless File.directory?([:out_dir]) raise "OUT_DIR exists and is not a directory." end end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/rpa/runner.rb', line 6 def @options end |
#photos ⇒ Object (readonly)
Returns the value of attribute photos.
6 7 8 |
# File 'lib/rpa/runner.rb', line 6 def photos @photos end |