class RBT::Linux::Slackware::GenerateSlackDescFile
Constants
- CHARACTERS_PER_LINE_MAXIMUM
#¶ ↑
CHARACTERS_PER_LINE_MAXIMUM
¶ ↑#¶ ↑
- HANDY_RULER
#¶ ↑
HANDY_RULER
¶ ↑#¶ ↑
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
- USE_THIS_FILE_SUFFIX
#¶ ↑
USE_THIS_FILE_SUFFIX
¶ ↑A proper slack-desc file ends with a .slack-desc suffix.
#¶ ↑
Public Class Methods
[](i = nil)
click to toggle source
new( this_program = ARGV, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
The first argument should be the name of the file in question.
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 61 def initialize( this_program = ARGV, run_already = true ) reset if block_given? yielded = yield case yielded when :use_short_name @use_long_name_or_short_name = :short_name end end set_this_program(this_program) run if run_already end
Public Instance Methods
chunk( string, size = CHARACTERS_PER_LINE_MAXIMUM )
click to toggle source
create_slack_desk_file()
click to toggle source
description?()
click to toggle source
generate_main_string()
click to toggle source
#¶ ↑
generate_main_string
¶ ↑
This will generate the main String, into the variable @_.
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 159 def generate_main_string result = ''.dup _ = name_of_program? _ = _.dup if short_description? _ << " (#{short_description?})" unless short_description?.empty? else e swarn('No short description for:') e swarn(_) end _ << N result << _ result << N result << chunk(description?) if result.is_a? String result = result.split(N) end @_ << result @_.flatten! # ======================================================================= # # Next, fill in the missing slots: # ======================================================================= # (11 - @_.size).times { @_ << '' } # ======================================================================= # # And then, prepend the program name to it. # ======================================================================= # @_.map {|line| line = line.dup if line.frozen? if line.empty? line.prepend("#{program_name?}:") else line.prepend("#{program_name?}: ") end } # ======================================================================= # # Next, we could add a handy ruler - but I personally find this # useless, so the following line is commented away. # ======================================================================= # # @_[0,0] = return_handy_ruler+N end
length_of_program_name?()
click to toggle source
obtain_main_dataset()
click to toggle source
path?()
click to toggle source
#¶ ↑
path?¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 229 def path? path = rds(Dir.pwd+'/').dup case @use_long_name_or_short_name # case tag when :long_name, :default # This is the default. path << return_name_of_slack_desc_file when :short_name path << return_short_name_of_slack_desc_file end path end
reset()
click to toggle source
return_handy_ruler()
click to toggle source
return_name_of_slack_desc_file()
click to toggle source
return_short_name()
click to toggle source
#¶ ↑
return_short_name
¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 212 def return_short_name USE_THIS_FILE_SUFFIX.delete('.') end
Also aliased as: return_short_name_of_slack_desc_file
run()
click to toggle source
set_this_program(i)
click to toggle source
short_description?()
click to toggle source