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

#each(&block) ⇒ Object



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

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