Module: CommitArt
- Defined in:
- lib/commit_art.rb,
lib/commit_art/version.rb
Constant Summary collapse
- VERSION =
"0.0.7"
Instance Attribute Summary collapse
-
#asciis_count ⇒ Object
readonly
TODO: use this.
Instance Method Summary collapse
-
#get_art ⇒ Object
gets a random art.
- #initialize ⇒ Object
- #path_to_asciis ⇒ Object
Instance Attribute Details
#asciis_count ⇒ Object (readonly)
TODO: use this
11 12 13 |
# File 'lib/commit_art.rb', line 11 def asciis_count @asciis_count end |
Instance Method Details
#get_art ⇒ Object
gets a random art
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/commit_art.rb', line 23 def get_art which_art = rand(22) # sweet file name stuff case which_art when 0..20 this_art = File.read("#{path_to_asciis}/#{format('%02d', which_art)}.txt") else puts "Invalid art choice." this_art = "" end end |
#initialize ⇒ Object
13 14 15 16 |
# File 'lib/commit_art.rb', line 13 def initialize dir = '../asciis' asciis_count = Dir[File.join(dir, '**', '*')].count { |file| File.file?(file) } end |
#path_to_asciis ⇒ Object
18 19 20 |
# File 'lib/commit_art.rb', line 18 def path_to_asciis File.join(File.dirname(File.(__FILE__)), '../asciis') end |