Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/net_shell/colors.rb,
lib/net_shell/prompt.rb

Instance Method Summary collapse

Instance Method Details

#shellsplit_partialObject



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_authorObject



122
123
124
# File 'lib/net_shell/colors.rb', line 122

def style_author
  self.colorize(:light_black)
end

#style_branchObject



114
115
116
# File 'lib/net_shell/colors.rb', line 114

def style_branch
  self.colorize(:red)
end

#style_build_nameObject



110
111
112
# File 'lib/net_shell/colors.rb', line 110

def style_build_name
  self.bold
end

#style_categoryObject



4
5
6
# File 'lib/net_shell/colors.rb', line 4

def style_category
  return self.colorize(:blue).bold
end

#style_cidrObject



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_classObject



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_clientObject



136
137
138
# File 'lib/net_shell/colors.rb', line 136

def style_client
  self.bold
end

#style_collection_nameObject



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_commandObject



62
63
64
# File 'lib/net_shell/colors.rb', line 62

def style_command
  self.colorize(:magenta).bold
end

#style_constant_nameObject



22
23
24
# File 'lib/net_shell/colors.rb', line 22

def style_constant_name
  self.colorize(:red)
end

#style_constant_valueObject



26
27
28
# File 'lib/net_shell/colors.rb', line 26

def style_constant_value
  self.colorize(:green).bold
end

#style_datacenterObject



70
71
72
# File 'lib/net_shell/colors.rb', line 70

def style_datacenter
  self.colorize(:green)
end

#style_environmentObject



66
67
68
# File 'lib/net_shell/colors.rb', line 66

def style_environment
  self.colorize(:red)
end

#style_errorObject



98
99
100
# File 'lib/net_shell/colors.rb', line 98

def style_error
  self.colorize(:red).bold
end

#style_event_codeObject



90
91
92
# File 'lib/net_shell/colors.rb', line 90

def style_event_code
  self.colorize(:blue).bold
end

#style_event_keyObject



94
95
96
# File 'lib/net_shell/colors.rb', line 94

def style_event_key
  self.colorize(:red)
end

#style_field_datatypeObject



54
55
56
# File 'lib/net_shell/colors.rb', line 54

def style_field_datatype
  self.colorize(:magenta)
end

#style_field_nameObject



50
51
52
# File 'lib/net_shell/colors.rb', line 50

def style_field_name
  self.colorize(:red)
end

#style_headingObject



132
133
134
# File 'lib/net_shell/colors.rb', line 132

def style_heading
  self.bold
end

#style_hostObject



74
75
76
# File 'lib/net_shell/colors.rb', line 74

def style_host
  self.colorize(:red)
end

#style_idObject



106
107
108
# File 'lib/net_shell/colors.rb', line 106

def style_id
  self.colorize(:green)
end

#style_ipObject



78
79
80
# File 'lib/net_shell/colors.rb', line 78

def style_ip
  self.colorize(:blue)
end

#style_method_nameObject



46
47
48
# File 'lib/net_shell/colors.rb', line 46

def style_method_name
  self.colorize(:blue)
end

#style_originObject



58
59
60
# File 'lib/net_shell/colors.rb', line 58

def style_origin
  self.colorize(:magenta)
end

#style_productObject



86
87
88
# File 'lib/net_shell/colors.rb', line 86

def style_product
  self.colorize(:red).bold
end

#style_protocol_nameObject



42
43
44
# File 'lib/net_shell/colors.rb', line 42

def style_protocol_name
  self.colorize(:light_blue).bold
end

#style_serviceObject



82
83
84
# File 'lib/net_shell/colors.rb', line 82

def style_service
  self.colorize(:magenta)
end

#style_timestampObject



118
119
120
# File 'lib/net_shell/colors.rb', line 118

def style_timestamp
  self.colorize(:blue)
end

#style_userdefinedObject



102
103
104
# File 'lib/net_shell/colors.rb', line 102

def style_userdefined
  self.colorize(:light_black).bold
end

#unstyleObject



146
147
148
# File 'lib/net_shell/colors.rb', line 146

def unstyle
  self.uncolorize
end