Class: CfScript::Command::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/cf_script/command/line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, bin, type, name, args = []) ⇒ Line

Returns a new instance of Line.



12
13
14
15
16
17
18
19
20
21
# File 'lib/cf_script/command/line.rb', line 12

def initialize(env, bin, type, name, args = [])
  @env     = env
  @bin     = bin

  @type    = type
  @name    = name
  @options = args.last.is_a?(Hash) ? args.pop : {}
  @flags   = options.delete(:flags) || []
  @args    = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



8
9
10
# File 'lib/cf_script/command/line.rb', line 8

def args
  @args
end

#binObject (readonly)

Returns the value of attribute bin.



5
6
7
# File 'lib/cf_script/command/line.rb', line 5

def bin
  @bin
end

#envObject (readonly)

Returns the value of attribute env.



4
5
6
# File 'lib/cf_script/command/line.rb', line 4

def env
  @env
end

#flagsObject (readonly)

Returns the value of attribute flags.



10
11
12
# File 'lib/cf_script/command/line.rb', line 10

def flags
  @flags
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/cf_script/command/line.rb', line 7

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/cf_script/command/line.rb', line 9

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/cf_script/command/line.rb', line 6

def type
  @type
end

Instance Method Details

#hide_sensitiveObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/cf_script/command/line.rb', line 28

def hide_sensitive
  case name
  when :auth
    hide_parts(-1, 'PASSWORD HIDDEN')
  when :login
    hide_option('-p', 'PASSWORD HIDDEN')
  else
    line
  end
end

#lineObject Also known as: to_s



23
24
25
# File 'lib/cf_script/command/line.rb', line 23

def line
  @line ||= format
end