Class: Branding::CLI
- Inherits:
-
Object
- Object
- Branding::CLI
- Defined in:
- lib/branding/cli.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/branding/cli.rb', line 6 def initialize(args) = OpenStruct.new .file = args.last @parser = OptionParser.new do |opts| opts. = 'Usage: branding FILE' opts.on('-p PIXEL', '--pixel=PIXEL', [:normal, :hires, :hicolor], 'The pixel rendering algorithm (`normal`, `hires`, or `hicolor`)') do |pixel_algo| .algo = pixel_algo.to_sym end opts.on_tail('-h', '--help', 'Show this message') do puts opts exit end end @parser.parse!(args) end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 |
# File 'lib/branding/cli.rb', line 30 def run logo = Branding::Logo.new(.file) logo.algo = .algo if .algo logo.print end |