class RBT::Gobolinux::NamingConvention

Public Class Methods

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

RBT::Gobolinux::NamingConvention[]

#
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 130
def self.[](i = '')
  new(i)
end
new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 43
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(i)
  run if run_already
end

Public Instance Methods

input?() click to toggle source
#

input?

#
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 71
def input?
  @input
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 55
def reset
  super()
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 78
def run
  _ = @input.downcase.dup
  if _.include? 'lib'
    _.gsub!(/lib/,'Lib')
  end
  if _.include? 'bin'
    _.gsub!(/bin/,'Bin')
  end
  if _.size < 4
    _.upcase!
  end
  # ======================================================================= #
  # === Check for stuff such as "libdrm", which will become "LibDRM".
  # ======================================================================= #
  if _.start_with? 'Lib' and _.size == 6
    _[-3,3] = _[-3,3].upcase
  end
  if _.include? 'info'
    _.sub!(/info/,'INFO')
  end
  if _.include? '-'
    splitted = _.split('-')
    splitted.map {|entry|
      entry[0,1] = entry[0,1].upcase
      entry
    }
    _ = splitted.join('-')
  end
  # ======================================================================= #
  # The first character will ALWAYS be upcased, no matter what.
  # ======================================================================= #
  _[0,1] = _[0,1].upcase
  set_translated_name(_)
end
set_input(i = '') click to toggle source
#

set_input

#
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 62
def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  @input = i
end
set_translated_name(i) click to toggle source
#

set_translated_name

#
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 116
def set_translated_name(i)
  @translated_name = i
end
translated_name?() click to toggle source
#

translated_name?

#
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 123
def translated_name?
  @translated_name
end