Skip to content

Commit

Permalink
Change the default ShadedAscii style to relative
Browse files Browse the repository at this point in the history
I only changed it in the executable :(
  • Loading branch information
Jamey J. DeOrio committed Apr 13, 2014
1 parent 6db28fc commit 6e3ba82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions honeybii.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'honeybii'
s.version = '2.0.3'
s.date = '2014-04-12'
s.version = '2.0.4'
s.date = '2014-04-13'
s.executables << 'honeybii'
s.add_runtime_dependency 'rmagick', ['~> 2.13', '>= 2.13.2']
s.files = ['lib/honeybii.rb', 'lib/honeybii/ascii_image.rb', 'lib/honeybii/shaded_ascii.rb']
Expand Down
5 changes: 4 additions & 1 deletion lib/honeybii/shaded_ascii.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class ShadedAscii < AsciiImage
class << self
attr_accessor :gradients
attr_accessor :styles
end

@gradients = [
Expand All @@ -9,9 +10,11 @@ class << self
['#', '+', ':', ' ', ' '],
['0', '1', ' ', ' '],
]
@styles = [ 'relative', 'one_to_one' ]

def initialize(image_filename, point_size = 12, gradient: 0, style: 'one_to_one')
def initialize(image_filename, point_size = 12, gradient: 0, style: 'relative')
super image_filename, point_size
raise ArgumentError, "style must be one of the following: #{ShadedAscii.styles}" unless ShadedAscii.styles.include? style
@gradient = ShadedAscii.gradients[gradient]
@style = style
to_ascii!
Expand Down
6 changes: 3 additions & 3 deletions test/test_shaded_ascii.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def test_image_can_use_different_gradients
end

def test_intensity_range_creates_different_ascii
shaded_1_to_1 = ShadedAscii.new('test/images/flower_bee.jpg', 14, style: '1_to_1')
shaded_relative = ShadedAscii.new('test/images/flower_bee.jpg', 14, style: 'relative')
refute_equal shaded_1_to_1.ascii, shaded_relative.ascii
shaded_relative = ShadedAscii.new('test/images/flower_bee.jpg', 14)
shaded_one_to_one = ShadedAscii.new('test/images/flower_bee.jpg', 14, style: 'one_to_one')
refute_equal shaded_one_to_one.ascii, shaded_relative.ascii
end
end

0 comments on commit 6e3ba82

Please sign in to comment.