Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.0.7:
* Replace calls to String#clone by String#dup so it doesn't error on frozen strings

0.0.6:
* Fixed args for puts/print (completely overlooked 0 args)
* Changed how nested spaces are passed around
Expand Down
6 changes: 3 additions & 3 deletions lib/inkjet/colors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ def self.included(base)
end

def colorize(color, str, wrap=false)
colorize!(color, str.clone, wrap)
colorize!(color, str.dup, wrap)
end

def colorize!(color, str, wrap=false)
str.apply_inkjet_code!(Inkjet::Colors.foreground(color), wrap)
end

def colorize_background(color, str, wrap=false)
colorize_background!(color, str.clone, wrap)
colorize_background!(color, str.dup, wrap)
end

def colorize_background!(color, str, wrap=false)
str.apply_inkjet_code!(Inkjet::Colors.background(color), wrap)
end

def colorize_with_background(fg_color, bg_color, str, wrap=false)
colorize_with_background!(fg_color, bg_color, str.clone, wrap)
colorize_with_background!(fg_color, bg_color, str.dup, wrap)
end

def colorize_with_background!(fg_color, bg_color, str, wrap=false)
Expand Down
10 changes: 5 additions & 5 deletions lib/inkjet/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def clean!
end

def clean
clone.clean!
dup.clean!
end

# Apply a formatting code to the appropriate chunks in the string.
Expand Down Expand Up @@ -86,13 +86,13 @@ def apply_inkjet_code!(code, wrap=false)
end

def apply_inkjet_code(code, wrap=false)
clone.apply_inkjet_code!(code, wrap)
dup.apply_inkjet_code!(code, wrap)
end

def apply_inkjet_codes(codes, wrap=false)
cloned = clone
codes.each { |code| cloned.apply_inkjet_code!(code, wrap) }
cloned
dupd = dup
codes.each { |code| dupd.apply_inkjet_code!(code, wrap) }
dupd
end

def apply_inkjet_codes!(codes, wrap=false)
Expand Down
2 changes: 1 addition & 1 deletion lib/inkjet/styles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.included(base)
end

def stylize(style, str, wrap=false)
stylize!(style, str.clone, wrap)
stylize!(style, str.dup, wrap)
end

def stylize!(style, str, wrap=false)
Expand Down
2 changes: 1 addition & 1 deletion lib/inkjet/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Inkjet
VERSION = '0.0.6'
VERSION = '0.0.7'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end