class ImageParadise::Base

Constants

N

Public Class Methods

new() click to toggle source
#

initialize

#
# File lib/image_paradise/base/base.rb, line 26
def initialize
end

Public Instance Methods

be_verbose?() click to toggle source
#

be_verbose?

#
# File lib/image_paradise/base/base.rb, line 76
def be_verbose?
  @be_verbose
end
cd(i)
Alias for: chdir
chdir(i) click to toggle source
#

chdir (cd tag)

#
# File lib/image_paradise/base/base.rb, line 186
def chdir(i)
  Dir.chdir(i)
end
Also aliased as: cd
commandline_arguments?() click to toggle source
#

commandline_arguments?

#
# File lib/image_paradise/base/base.rb, line 114
def commandline_arguments?
  @commandline_arguments
end
commandline_arguments_as_stripped_string() click to toggle source
#

commandline_arguments_as_stripped_string

This variant will return the commandline arguments as a String.

Note that any –hyphened argument will be ignored.

#
# File lib/image_paradise/base/base.rb, line 151
def commandline_arguments_as_stripped_string
  @commandline_arguments.reject {|entry|
    entry.start_with?('--')
  }.join(' ').strip
end
commandline_arguments_starting_with_hyphens?() click to toggle source
#

commandline_arguments_starting_with_hyphens?

#
# File lib/image_paradise/base/base.rb, line 140
def commandline_arguments_starting_with_hyphens?
  return @commandline_arguments.select {|entry| entry.start_with? '--' }
end
commandline_arguments_via_leading_hyphens()
eparse(i) click to toggle source
#

eparse

#
# File lib/image_paradise/base/base.rb, line 62
def eparse(i)
  Colours.eparse(i)
end
esystem(i) click to toggle source
#

esystem

#
# File lib/image_paradise/base/base.rb, line 55
def esystem(i)
  ::ImageParadise.esystem(i)
end
first?()
Alias for: first_argument?
first_argument?() click to toggle source
#

first_argument?

#
# File lib/image_paradise/base/base.rb, line 121
def first_argument?
  @commandline_arguments.first
end
Also aliased as: first?
first_argument_without_hyphen?() click to toggle source
#

first_argument_without_hyphen?

#
# File lib/image_paradise/base/base.rb, line 128
def first_argument_without_hyphen?
  _ = @commandline_arguments.select {|entry| !entry.start_with? '--' }
  if _
    _.first
  else
    nil
  end
end
increment_this_number_by_one(i) click to toggle source
#

increment_this_number_by_one

#
# File lib/image_paradise/base/base.rb, line 90
def increment_this_number_by_one(i)
  ::ImageParadise.increment_this_number_by_one(i)
end
is_an_image_file?(i) click to toggle source
#

is_an_image_file?

#
# File lib/image_paradise/base/base.rb, line 217
def is_an_image_file?(i)
  ::ImageParadise.is_an_image_file?(i)
end
is_on_roebe?() click to toggle source
#

is_on_roebe?

#
# File lib/image_paradise/base/base.rb, line 172
def is_on_roebe?
  ::ImageParadise.is_on_roebe?
end
mkdir(i) click to toggle source
#

mkdir

#
# File lib/image_paradise/base/base.rb, line 69
def mkdir(i)
  FileUtils.mkdir_p(i) unless File.directory? i
end
Also aliased as: mkdir_p
mkdir_p(i)
Alias for: mkdir
opnn( i = @namespace ) click to toggle source
#

opnn

#
# File lib/image_paradise/base/base.rb, line 160
def opnn(
    i = @namespace
  )
  if i.is_a? String
    i = { namespace: i }
  end
  Opn.opn(i)
end
output_file_exists?( i = name_of_the_output_file? ) click to toggle source
#

output_file_exists?

#
# File lib/image_paradise/base/base.rb, line 97
def output_file_exists?(
    i = name_of_the_output_file?
  )
  File.exist? i.to_s
end
rds(i) click to toggle source
#

rds

rds is an abbreviation for “remove double slashes”, e. g. “//” to to become “/”.

#
# File lib/image_paradise/base/base.rb, line 196
def rds(i)
  if i.is_a? Array
    i.map {|entry| rds(entry) }
  else
    i.squeeze('/')
  end
end
register_sigint() click to toggle source
#

register_sigint

#
# File lib/image_paradise/base/base.rb, line 38
def register_sigint
  Signal.trap('SIGINT') {
    e 'Exiting now, as requested.'
    exit
  }
end
reset() click to toggle source
#

reset

#
# File lib/image_paradise/base/base.rb, line 32
def reset
end
return_all_images_from(this_directory) click to toggle source
#

return_all_images_from

#
# File lib/image_paradise/base/base.rb, line 207
def return_all_images_from(this_directory)
  target = rds(this_directory+'/**/**')
  Dir[target].select {|entry|
    is_an_image_file?(entry)
  }
end
return_pwd() click to toggle source
#

return_pwd

#
# File lib/image_paradise/base/base.rb, line 179
def return_pwd
  rds("#{Dir.pwd}/")
end
set_commandline_arguments(i = '') click to toggle source
#

set_commandline_arguments

#
# File lib/image_paradise/base/base.rb, line 106
def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end
today() click to toggle source
#

today

#
# File lib/image_paradise/base/base.rb, line 83
def today
  "#{Time.now.strftime('%d.%m.%Y')}_#{Time.now.strftime('%H:%M:%S.%L')}"
end
write_what_into(what, into) click to toggle source
#

write_what_into

#
# File lib/image_paradise/base/base.rb, line 48
def write_what_into(what, into)
  ::SaveFile.write_what_into(what, into)
end