Class: HaveAPI::ExampleList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/haveapi/example_list.rb

Instance Method Summary collapse

Constructor Details

#initializeExampleList

Returns a new instance of ExampleList.



3
4
5
# File 'lib/haveapi/example_list.rb', line 3

def initialize
  @examples = []
end

Instance Method Details

#<<(example) ⇒ Object

Parameters:



8
9
10
# File 'lib/haveapi/example_list.rb', line 8

def <<(example)
  @examples << example
end

#describe(context) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/haveapi/example_list.rb', line 12

def describe(context)
  ret = []

  @examples.each do |e|
    ret << e.describe(context) if e.authorized?(context)
  end

  ret
end

#eachObject



28
29
30
# File 'lib/haveapi/example_list.rb', line 28

def each(&)
  @examples.each(&)
end

#validate_build(action, path:) ⇒ Object



22
23
24
25
26
# File 'lib/haveapi/example_list.rb', line 22

def validate_build(action, path:)
  @examples.each_with_index do |example, index|
    example.validate_build(action, path:, index:)
  end
end