Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/net_shell/colors.rb,
lib/net_shell/prompt.rb
Instance Method Summary collapse
- #shellsplit_partial ⇒ Object
- #style(type) ⇒ Object
- #style_author ⇒ Object
- #style_branch ⇒ Object
- #style_build_name ⇒ Object
- #style_category ⇒ Object
- #style_cidr ⇒ Object
- #style_class ⇒ Object
- #style_client ⇒ Object
- #style_collection_name ⇒ Object
- #style_command ⇒ Object
- #style_constant_name ⇒ Object
- #style_constant_value ⇒ Object
- #style_datacenter ⇒ Object
- #style_environment ⇒ Object
- #style_error ⇒ Object
- #style_event_code ⇒ Object
- #style_event_key ⇒ Object
- #style_field_datatype ⇒ Object
- #style_field_name ⇒ Object
- #style_heading ⇒ Object
- #style_host ⇒ Object
- #style_id ⇒ Object
- #style_ip ⇒ Object
- #style_method_name ⇒ Object
- #style_origin ⇒ Object
- #style_product ⇒ Object
- #style_protocol_name ⇒ Object
- #style_service ⇒ Object
- #style_timestamp ⇒ Object
- #style_userdefined ⇒ Object
- #unstyle ⇒ Object
Instance Method Details
#shellsplit_partial ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/net_shell/prompt.rb', line 5 def shellsplit_partial begin shellsplit rescue ArgumentError begin (self + "\"").shellsplit rescue (self + "'").shellsplit rescue [] end end end |
#style(type) ⇒ Object
140 141 142 143 144 |
# File 'lib/net_shell/colors.rb', line 140 def style(type) method = ("style_" + type.to_s).to_sym return send(method) if self.methods.include?(method) self end |
#style_author ⇒ Object
122 123 124 |
# File 'lib/net_shell/colors.rb', line 122 def self.colorize(:light_black) end |
#style_branch ⇒ Object
114 115 116 |
# File 'lib/net_shell/colors.rb', line 114 def style_branch self.colorize(:red) end |
#style_build_name ⇒ Object
110 111 112 |
# File 'lib/net_shell/colors.rb', line 110 def style_build_name self.bold end |
#style_category ⇒ Object
4 5 6 |
# File 'lib/net_shell/colors.rb', line 4 def style_category return self.colorize(:blue).bold end |
#style_cidr ⇒ Object
126 127 128 129 130 |
# File 'lib/net_shell/colors.rb', line 126 def style_cidr ip, whack = self.split("/") return self.colorize(:red) if ip.nil? or whack.nil? ip.colorize(:red) + "/" + whack.colorize(:magenta) end |
#style_class ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/net_shell/colors.rb', line 8 def style_class return self.colorize(:light_black) if self == "none" comps = split(".") (comps.map do |comp| if comp == comps.last then comp.colorize(:red).bold else comp.colorize(:light_black) end end).join(".") end |
#style_client ⇒ Object
136 137 138 |
# File 'lib/net_shell/colors.rb', line 136 def style_client self.bold end |
#style_collection_name ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/net_shell/colors.rb', line 30 def style_collection_name comps = split(".") (comps.map do |comp| if comp == comps.last then comp.colorize(:green).bold else comp.colorize(:light_black) end end).join(".") end |
#style_command ⇒ Object
62 63 64 |
# File 'lib/net_shell/colors.rb', line 62 def style_command self.colorize(:magenta).bold end |
#style_constant_name ⇒ Object
22 23 24 |
# File 'lib/net_shell/colors.rb', line 22 def style_constant_name self.colorize(:red) end |
#style_constant_value ⇒ Object
26 27 28 |
# File 'lib/net_shell/colors.rb', line 26 def style_constant_value self.colorize(:green).bold end |
#style_datacenter ⇒ Object
70 71 72 |
# File 'lib/net_shell/colors.rb', line 70 def style_datacenter self.colorize(:green) end |
#style_environment ⇒ Object
66 67 68 |
# File 'lib/net_shell/colors.rb', line 66 def style_environment self.colorize(:red) end |
#style_error ⇒ Object
98 99 100 |
# File 'lib/net_shell/colors.rb', line 98 def style_error self.colorize(:red).bold end |
#style_event_code ⇒ Object
90 91 92 |
# File 'lib/net_shell/colors.rb', line 90 def style_event_code self.colorize(:blue).bold end |
#style_event_key ⇒ Object
94 95 96 |
# File 'lib/net_shell/colors.rb', line 94 def style_event_key self.colorize(:red) end |
#style_field_datatype ⇒ Object
54 55 56 |
# File 'lib/net_shell/colors.rb', line 54 def style_field_datatype self.colorize(:magenta) end |
#style_field_name ⇒ Object
50 51 52 |
# File 'lib/net_shell/colors.rb', line 50 def style_field_name self.colorize(:red) end |
#style_heading ⇒ Object
132 133 134 |
# File 'lib/net_shell/colors.rb', line 132 def style_heading self.bold end |
#style_host ⇒ Object
74 75 76 |
# File 'lib/net_shell/colors.rb', line 74 def style_host self.colorize(:red) end |
#style_id ⇒ Object
106 107 108 |
# File 'lib/net_shell/colors.rb', line 106 def style_id self.colorize(:green) end |
#style_ip ⇒ Object
78 79 80 |
# File 'lib/net_shell/colors.rb', line 78 def style_ip self.colorize(:blue) end |
#style_method_name ⇒ Object
46 47 48 |
# File 'lib/net_shell/colors.rb', line 46 def style_method_name self.colorize(:blue) end |
#style_origin ⇒ Object
58 59 60 |
# File 'lib/net_shell/colors.rb', line 58 def style_origin self.colorize(:magenta) end |
#style_product ⇒ Object
86 87 88 |
# File 'lib/net_shell/colors.rb', line 86 def style_product self.colorize(:red).bold end |
#style_protocol_name ⇒ Object
42 43 44 |
# File 'lib/net_shell/colors.rb', line 42 def style_protocol_name self.colorize(:light_blue).bold end |
#style_service ⇒ Object
82 83 84 |
# File 'lib/net_shell/colors.rb', line 82 def style_service self.colorize(:magenta) end |
#style_timestamp ⇒ Object
118 119 120 |
# File 'lib/net_shell/colors.rb', line 118 def self.colorize(:blue) end |
#style_userdefined ⇒ Object
102 103 104 |
# File 'lib/net_shell/colors.rb', line 102 def style_userdefined self.colorize(:light_black).bold end |
#unstyle ⇒ Object
146 147 148 |
# File 'lib/net_shell/colors.rb', line 146 def unstyle self.uncolorize end |