Class: Spectroscope::Example::Scope

Inherits:
World
  • Object
show all
Defined in:
lib/spectroscope/example.rb

Overview

Example::Scope is used by Context to create a shared scope for running examples.

Instance Method Summary collapse

Constructor Details

#initialize(group) ⇒ Scope

Returns a new instance of Scope.

Parameters:



182
183
184
185
186
187
188
# File 'lib/spectroscope/example.rb', line 182

def initialize(group)
  @_group = group
  extend group.scope
  #include group.scope
  #extend self
  @_let ||= {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(s, *a, &b) ⇒ Object (private)

Handle implicit subject.



215
216
217
# File 'lib/spectroscope/example.rb', line 215

def method_missing(s, *a, &b)
  subject.__send__(s, *a, &b)  # public_send
end

Instance Method Details

#pending(message = nil) ⇒ Object

Raises:

  • (NotImplementedError)

    Example is a “todo”.



193
194
195
# File 'lib/spectroscope/example.rb', line 193

def pending(message=nil)
  raise NotImplementedError.new(message)
end

#subjectObject



200
201
202
203
204
205
206
207
208
# File 'lib/spectroscope/example.rb', line 200

def subject
  @_subject ||= (
    if defined?(super)
      super || described_class.new
    else
      described_class.new
    end
  )
end