class Cookbooks::FindHeaders

Constants

NAMESPACE
#

NAMESPACE

#

Public Class Methods

new( i = nil, run_already = true ) click to toggle source
#

initialize

#
Calls superclass method
# File lib/cookbooks/utility_scripts/find_headers.rb, line 32
def initialize(
    i           = nil,
    run_already = true
  )
  super()
  reset
  set_input(i)
  run if run_already
end

Public Instance Methods

do_find_headers() click to toggle source
#

#do_find_headers

#
# File lib/cookbooks/utility_scripts/find_headers.rb, line 102
def do_find_headers
  headers = obtain_headers
  if headers.is_a? Array # Convert the Array into a String here.
    headers = headers.join(',').strip
  end
  headers.delete!(' ') if headers
  unless headers.to_s.empty?
    report_that_we_have_found_these_headers(headers)
  end
end
input?() click to toggle source
#

input?

#
# File lib/cookbooks/utility_scripts/find_headers.rb, line 61
def input?
  @input
end
obtain_headers() click to toggle source
#

#obtain_headers

#
# File lib/cookbooks/utility_scripts/find_headers.rb, line 68
def obtain_headers
  Cookbooks::Cookbook.new(input?).headers?
end
opnn() click to toggle source
#

opnn

#
Calls superclass method Cookbooks::Base#opnn
# File lib/cookbooks/utility_scripts/find_headers.rb, line 95
def opnn
  super(NAMESPACE)
end
report_that_we_have_found_these_headers(headers) click to toggle source
#

#report_that_we_have_found_these_headers

We do assume here that the input argument to this method is a String which will contain ',' characters.

#
# File lib/cookbooks/utility_scripts/find_headers.rb, line 78
def report_that_we_have_found_these_headers(headers)
  if headers.include? ','
    splitted = headers.split(',')
  else
    splitted = (headers+',').split(',')
  end
  opnn; e 'The following '+simp(splitted.size.to_s)+
          ' header files were found for the '\
          'program `'+sfancy(input?)+'`.'
  splitted.each {|the_header|
    e '  - '+the_header
  }
end
reset() click to toggle source
#

reset

#
Calls superclass method Cookbooks::Base#reset
# File lib/cookbooks/utility_scripts/find_headers.rb, line 45
def reset
  super()
end
run() click to toggle source
#

run (run tag)

#
# File lib/cookbooks/utility_scripts/find_headers.rb, line 116
def run
  do_find_headers
end
set_input(i = '') click to toggle source
#

#set_input

#
# File lib/cookbooks/utility_scripts/find_headers.rb, line 52
def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup if i
  @input = i
end