Class: String
Instance Method Summary collapse
- #-@ ⇒ Object
-
#/(other) ⇒ Object
Make an executable out of File.join(self, other).
- #>(other) ⇒ Object
- #>>(other) ⇒ Object
- #black ⇒ Object
- #blue ⇒ Object
- #brown ⇒ Object
- #cyan ⇒ Object
- #dark_gray ⇒ Object
- #green ⇒ Object
- #light_blue ⇒ Object
- #light_cyan ⇒ Object
- #light_gray ⇒ Object
- #light_green ⇒ Object
- #light_purple ⇒ Object
- #light_red ⇒ Object
- #map_lines(&block) ⇒ Object
- #nothing ⇒ Object
- #purple ⇒ Object
- #red ⇒ Object
- #white ⇒ Object
- #yellow ⇒ Object
- #|(other) ⇒ Object
Instance Method Details
#-@ ⇒ Object
4 5 6 |
# File 'lib/chitin/core_ext/string.rb', line 4 def -@ "-#{self}" end |
#/(other) ⇒ Object
Make an executable out of File.join(self, other)
31 32 33 |
# File 'lib/chitin/core_ext/string.rb', line 31 def /(other) Chitin::Executable.new File.join(self, other.to_s) end |
#>(other) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/chitin/core_ext/string.rb', line 52 def >(other) case other when Chitin::FileObject other.to_a.each do |fo| next if fo.directory? File.open(fo.to_s, 'w') {|f| f.puts self } end when String File.open(other, 'w') {|f| f.puts self } else raise "Unknown piping type: #{other.class}" end other end |
#>>(other) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/chitin/core_ext/string.rb', line 35 def >>(other) case other when Chitin::FileObject other.to_a.each do |fo| next if fo.directory? File.open(fo.to_s, 'a') {|f| f.puts self } end when String File.open(other, 'a') {|f| f.puts self } else raise "Unknown piping type: #{other.class}" end other end |
#black ⇒ Object
9 |
# File 'lib/chitin/core_ext/string.rb', line 9 def black ; Wirble::Colorize.colorize_string self, :black ; end |
#blue ⇒ Object
13 |
# File 'lib/chitin/core_ext/string.rb', line 13 def blue ; Wirble::Colorize.colorize_string self, :blue ; end |
#brown ⇒ Object
12 |
# File 'lib/chitin/core_ext/string.rb', line 12 def brown ; Wirble::Colorize.colorize_string self, :brown ; end |
#cyan ⇒ Object
14 |
# File 'lib/chitin/core_ext/string.rb', line 14 def cyan ; Wirble::Colorize.colorize_string self, :cyan ; end |
#dark_gray ⇒ Object
17 |
# File 'lib/chitin/core_ext/string.rb', line 17 def dark_gray ; Wirble::Colorize.colorize_string self, :dark_gray ; end |
#green ⇒ Object
11 |
# File 'lib/chitin/core_ext/string.rb', line 11 def green ; Wirble::Colorize.colorize_string self, :green ; end |
#light_blue ⇒ Object
21 |
# File 'lib/chitin/core_ext/string.rb', line 21 def light_blue ; Wirble::Colorize.colorize_string self, :light_blue ; end |
#light_cyan ⇒ Object
22 |
# File 'lib/chitin/core_ext/string.rb', line 22 def light_cyan ; Wirble::Colorize.colorize_string self, :light_cyan ; end |
#light_gray ⇒ Object
16 |
# File 'lib/chitin/core_ext/string.rb', line 16 def light_gray ; Wirble::Colorize.colorize_string self, :light_gray ; end |
#light_green ⇒ Object
19 |
# File 'lib/chitin/core_ext/string.rb', line 19 def light_green ; Wirble::Colorize.colorize_string self, :light_green ; end |
#light_purple ⇒ Object
23 |
# File 'lib/chitin/core_ext/string.rb', line 23 def light_purple; Wirble::Colorize.colorize_string self, :light_purple; end |
#light_red ⇒ Object
18 |
# File 'lib/chitin/core_ext/string.rb', line 18 def light_red ; Wirble::Colorize.colorize_string self, :light_red ; end |
#map_lines(&block) ⇒ Object
26 27 28 |
# File 'lib/chitin/core_ext/string.rb', line 26 def map_lines(&block) split("\n").map(&block) end |
#nothing ⇒ Object
8 |
# File 'lib/chitin/core_ext/string.rb', line 8 def nothing ; Wirble::Colorize.colorize_string self, :nothing ; end |
#purple ⇒ Object
15 |
# File 'lib/chitin/core_ext/string.rb', line 15 def purple ; Wirble::Colorize.colorize_string self, :purple ; end |
#red ⇒ Object
10 |
# File 'lib/chitin/core_ext/string.rb', line 10 def red ; Wirble::Colorize.colorize_string self, :red ; end |
#white ⇒ Object
24 |
# File 'lib/chitin/core_ext/string.rb', line 24 def white ; Wirble::Colorize.colorize_string self, :white ; end |
#yellow ⇒ Object
20 |
# File 'lib/chitin/core_ext/string.rb', line 20 def yellow ; Wirble::Colorize.colorize_string self, :yellow ; end |
#|(other) ⇒ Object
69 70 71 |
# File 'lib/chitin/core_ext/string.rb', line 69 def |(other) NULLIN > L { self } | other end |