Class: CfScript::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/cf_script/object/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_endpoint = '', org = '', space = '', user = nil) ⇒ Target

Returns a new instance of Target.



8
9
10
11
12
13
# File 'lib/cf_script/object/target.rb', line 8

def initialize(api_endpoint = '', org = '', space = '', user = nil)
  @api_endpoint = api_endpoint
  @org          = org
  @space        = space
  @user         = user
end

Instance Attribute Details

#api_endpointObject (readonly)

Returns the value of attribute api_endpoint.



2
3
4
# File 'lib/cf_script/object/target.rb', line 2

def api_endpoint
  @api_endpoint
end

#orgObject (readonly)

Returns the value of attribute org.



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

def org
  @org
end

#spaceObject

Returns the value of attribute space.



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

def space
  @space
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'lib/cf_script/object/target.rb', line 3

def user
  @user
end

Instance Method Details

#to_optionsObject



15
16
17
18
19
20
21
22
# File 'lib/cf_script/object/target.rb', line 15

def to_options
  options = {}

  options[:o] = @org   if @org and not @org.empty?
  options[:s] = @space if @space and not @space.empty?

  options
end