Class: Podjumper::JumpInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/podjumper/jump_info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#container_nameObject

Returns the value of attribute container_name

Returns:

  • (Object)

    the current value of container_name



4
5
6
# File 'lib/podjumper/jump_info.rb', line 4

def container_name
  @container_name
end

#namespaceObject

Returns the value of attribute namespace

Returns:

  • (Object)

    the current value of namespace



4
5
6
# File 'lib/podjumper/jump_info.rb', line 4

def namespace
  @namespace
end

#podObject

Returns the value of attribute pod

Returns:

  • (Object)

    the current value of pod



4
5
6
# File 'lib/podjumper/jump_info.rb', line 4

def pod
  @pod
end

Class Method Details

.load(args) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/podjumper/jump_info.rb', line 15

def load(args)
  args = args.dup
  namespace = disambiguate_namespace(args.shift)
  pod = disambiguate_pod(namespace, args.shift)
  container = disambiguate_container(pod, args.shift)

  new(namespace, pod, container)
end

.load_rails_from_subdomain(subdomain) ⇒ Object



39
40
41
42
# File 'lib/podjumper/jump_info.rb', line 39

def load_rails_from_subdomain(subdomain)
  pod = Pod.where(subdomain: subdomain).first
  new(pod.namespace, pod, pod.container('rails'))
end

.load_upto_namespace(args) ⇒ Object



32
33
34
35
36
37
# File 'lib/podjumper/jump_info.rb', line 32

def load_upto_namespace(args)
  args = args.dup
  namespace = disambiguate_namespace(args.shift)

  new(namespace, nil, nil)
end

.load_upto_pod(args) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/podjumper/jump_info.rb', line 24

def load_upto_pod(args)
  args = args.dup
  namespace = disambiguate_namespace(args.shift)
  pod = disambiguate_pod(namespace, args.shift)

  new(namespace, pod, nil)
end

Instance Method Details

#pod_nameObject



9
10
11
# File 'lib/podjumper/jump_info.rb', line 9

def pod_name
  pod&.name
end

#subdomainObject



5
6
7
# File 'lib/podjumper/jump_info.rb', line 5

def subdomain
  pod&.subdomain
end