class ImageParadise::CreateNewImage

Constants

DELETE_OUTPUT_FILE_IF_IT_EXISTS
#

DELETE_OUTPUT_FILE_IF_IT_EXISTS

#

Public Class Methods

[](i = '') click to toggle source
#

ImageParadise::CreateNewImage[]

#
# File lib/image_paradise/utility_scripts/create_new_image.rb, line 101
def self.[](i = '')
  new(i)
end
new( i = ARGV, run_already = true ) click to toggle source
#

initialize

#
# File lib/image_paradise/utility_scripts/create_new_image.rb, line 31
def initialize(
    i           = ARGV,
    run_already = true
  )
  reset
  set_commandline_arguments(i)
  set_first_commandline_argument(i)
  run if run_already
end

Public Instance Methods

first_commandline_argument?()
Alias for: this_image_file?
input?()
Alias for: this_image_file?
menu( i = commandline_arguments_starting_with_hyphens? ) click to toggle source
#

menu (menu tag)

#
name_of_the_output_file?() click to toggle source
#

name_of_the_output_file?

#
# File lib/image_paradise/utility_scripts/create_new_image.rb, line 71
def name_of_the_output_file?
  'OUTPUT_'+first_commandline_argument?.sub(/\.png$/,'').sub(/\.jpg$/,'')+'.png'
end
Also aliased as: output_file?
output_file?()
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method ImageParadise::Base#reset
# File lib/image_paradise/utility_scripts/create_new_image.rb, line 44
def reset
  super()
  # ======================================================================= #
  # === @use_this_background_colour
  # ======================================================================= #
  @use_this_background_colour = :white
end
run() click to toggle source
#

run (run tag)

#
# File lib/image_paradise/utility_scripts/create_new_image.rb, line 91
def run
  menu
  _ = first_commandline_argument?
  esystem "convert -size #{_} canvas:#{@use_this_background_colour} "+
          name_of_the_output_file?
end
set_first_commandline_argument(i) click to toggle source
#

set_first_commandline_argument

#
# File lib/image_paradise/utility_scripts/create_new_image.rb, line 55
def set_first_commandline_argument(i)
  i = [i].flatten.compact
  @first_commandline_argument = i
end
this_image_file?() click to toggle source
#

this_image_file?

#
# File lib/image_paradise/utility_scripts/create_new_image.rb, line 63
def this_image_file?
  @first_commandline_argument.first.to_s
end