Class: Despecable::Spectator

Inherits:
BasicObject
Defined in:
lib/despecable/spectator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Spectator

Returns a new instance of Spectator.



9
10
11
12
13
14
15
# File 'lib/despecable/spectator.rb', line 9

def initialize(params)
  @input_params = params
  # TODO: allow this to be the same object to save copies
  @params = {}
  @spectacles = ::Despecable::Spectacles.new
  @specd = []
end

Instance Attribute Details

#paramsObject (readonly)

This class is used to read (eval) the despec block Any methods in that block must be defined here, and this object must be stateful to be read by the controller



7
8
9
# File 'lib/despecable/spectator.rb', line 7

def params
  @params
end

#specdObject (readonly)

This class is used to read (eval) the despec block Any methods in that block must be defined here, and this object must be stateful to be read by the controller



7
8
9
# File 'lib/despecable/spectator.rb', line 7

def specd
  @specd
end

Instance Method Details

#any(name, options = {}) ⇒ Object



45
46
47
# File 'lib/despecable/spectator.rb', line 45

def any(name, options = {})
  _spec(name, :any, options)
end

#boolean(name, options = {}) ⇒ Object



25
26
27
# File 'lib/despecable/spectator.rb', line 25

def boolean(name, options = {})
  _spec(name, :boolean, options)
end

#custom(name, options = {}, &blk) ⇒ Object



49
50
51
# File 'lib/despecable/spectator.rb', line 49

def custom(name, options = {}, &blk)
  _spec(name, :custom, options, &blk)
end

#date(name, options = {}) ⇒ Object



29
30
31
# File 'lib/despecable/spectator.rb', line 29

def date(name, options = {})
  _spec(name, :date, options)
end

#datetime(name, options = {}) ⇒ Object



33
34
35
# File 'lib/despecable/spectator.rb', line 33

def datetime(name, options = {})
  _spec(name, :datetime, options)
end

#file(name, options = {}) ⇒ Object



41
42
43
# File 'lib/despecable/spectator.rb', line 41

def file(name, options = {})
  _spec(name, :file, options)
end

#float(name, options = {}) ⇒ Object



37
38
39
# File 'lib/despecable/spectator.rb', line 37

def float(name, options = {})
  _spec(name, :float, options)
end

#integer(name, options = {}) ⇒ Object



17
18
19
# File 'lib/despecable/spectator.rb', line 17

def integer(name, options = {})
  _spec(name, :integer, options)
end

#string(name, options = {}) ⇒ Object



21
22
23
# File 'lib/despecable/spectator.rb', line 21

def string(name, options = {})
  _spec(name, :string, options)
end