Class: Eco::API::Session::Config::PostLaunch

Inherits:
BaseConfig show all
Includes:
Enumerable
Defined in:
lib/eco/api/session/config/post_launch.rb

Instance Attribute Summary

Attributes inherited from BaseConfig

#config

Instance Method Summary collapse

Methods inherited from BaseConfig

#clone

Methods inherited from Hash

#deep_merge, #deep_merge!

Constructor Details

#initialize(config:) ⇒ PostLaunch

Returns a new instance of PostLaunch.



8
9
10
11
# File 'lib/eco/api/session/config/post_launch.rb', line 8

def initialize(config:)
  @postcases = []
  super(config: config)
end

Instance Method Details

#add(name, type: nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/eco/api/session/config/post_launch.rb', line 30

def add(name, type: nil)
  @postcases.push({
    name: name,
    type: type
  })
end

#each(&block) ⇒ Object



21
22
23
24
# File 'lib/eco/api/session/config/post_launch.rb', line 21

def each(&block)
  return to_enum(:each) unless block
  items.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/eco/api/session/config/post_launch.rb', line 17

def empty?
  count == 0
end

#itemsObject



26
27
28
# File 'lib/eco/api/session/config/post_launch.rb', line 26

def items
  @postcases
end

#lengthObject



13
14
15
# File 'lib/eco/api/session/config/post_launch.rb', line 13

def length
  count
end

#select(usecases) ⇒ Object



37
38
39
40
41
42
# File 'lib/eco/api/session/config/post_launch.rb', line 37

def select(usecases)
  raise "Required Eco::API::UseCases to select the target post cases" unless usecases.is_a?(Eco::API::UseCases)
  each_with_object([]) do |pc, targets|
    targets.push(usecases.case(pc[:name], type: pc[:type]))
  end
end