class Tiling::Option
Public: Set the options.
Public Class Methods
new()
click to toggle source
# File lib/tiling/option.rb, line 9 def initialize @options = {horizontal: false, vertical: false, version: false } optparse = OptionParser.new do|opts| opts.on( '-H', '--horizontal', 'Horizontal layout' ) do @options[:horizontal] = true end opts.on( '-V', '--vertical', 'Vertical layout' ) do @options[:vertical] = true end opts.on( '-v', '--version', 'Print version number and exit' ) do @options[:version] = true end opts.on( '-h', '--help', 'Display this screen' ) do puts opts exit end end begin optparse.parse! rescue OptionParser::InvalidOption => e puts e.to_s exit 1 end print_version if @options[:version] end
Public Instance Methods
[](key)
click to toggle source
# File lib/tiling/option.rb, line 37 def [](key) @options[key] end
Private Instance Methods
print_version()
click to toggle source
# File lib/tiling/option.rb, line 43 def print_version puts "wlayout #{File.read(File.join($WLAYOUT_PATH, 'VERSION')).strip}" exit end