Module: Ascuchiii
- Defined in:
- lib/ascuchiii.rb
Class Method Summary collapse
Class Method Details
.images ⇒ Object
17 18 19 20 21 |
# File 'lib/ascuchiii.rb', line 17 def self.images [ 'default-cuchi-with-hat.jpeg' ] end |
.parse_img_args ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ascuchiii.rb', line 29 def self.parse_img_args default_image_args = { width: 50, color: true } OptionParser.new do |parser| parser.on('-w [WIDTH]', '--width [WIDTH]', 'Cuchi image WIDTH. Default: 50. Ex ascuchiii -w 200', Integer) parser.on('-c [COLOR]', '--color [COLOR]', 'Should render with image with colors. Default: true. Ex: ascuchiii -c (with color/true) | ascuchiii -c false (without color/false)') do |color| # `color.nil?` verifies if the input is just `-X` (considered true). # If -X has an argument, convert it to bool default_image_args[:color] = color.nil? || color.to_s == 'true' end end.parse!(into: default_image_args) default_image_args end |
.show ⇒ Object
50 51 52 53 54 |
# File 'lib/ascuchiii.rb', line 50 def self.show Artii::Base.new.asciify(words.sample) AsciiArt.new("#{url}/#{images.sample}?raw=true").to_ascii_art(parse_img_args) end |
.url ⇒ Object
23 24 25 26 27 |
# File 'lib/ascuchiii.rb', line 23 def self.url # It will be kinda tricky to make it work with images bundled together with the gem # so let's just use a static one hosted at the repo 'https://github.com/kammradt/ascuchiii/blob/master/lib/images' end |
.words ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/ascuchiii.rb', line 8 def self.words [ 'P A U L O', 'C U C H I', 'P A U L O C U C H I', 'L A G E S' ] end |