Module: Pears
- Extended by:
- Dry::Configurable
- Defined in:
- lib/pears.rb,
lib/pears/web.rb,
lib/pears/errors.rb,
lib/pears/subject.rb,
lib/pears/testing.rb,
lib/pears/testing.rb,
lib/pears/version.rb,
lib/pears/commands.rb,
lib/pears/provider.rb,
lib/pears/provider/env.rb,
lib/pears/provider/base.rb,
lib/pears/provider/hash.rb,
lib/pears/provider/loco.rb,
lib/pears/testing/subject.rb,
lib/pears/provider/builder.rb,
lib/pears/provider/debugger.rb,
lib/pears/provider/local_file.rb,
lib/pears/provider/remote_file.rb,
lib/pears/provider/rails_config.rb,
lib/pears/provider/subscription.rb
Defined Under Namespace
Modules: Commands, Provider, Testing Classes: Error, InvalidProviderData, RedisHasLeftTheBuilding, Subject, SubjectNotfound, Web
Constant Summary collapse
- VERSION =
"0.3.5"
Class Method Summary collapse
- .[](name) ⇒ Object
-
.subject(name, &block) ⇒ Object
This is the main way of locating a subject.
- .subjects ⇒ Object
Class Method Details
.[](name) ⇒ Object
27 28 29 |
# File 'lib/pears.rb', line 27 def self.[](name) subjects.find { |subject| subject.name == name } end |
.subject(name, &block) ⇒ Object
This is the main way of locating a subject.
19 20 21 22 23 24 25 |
# File 'lib/pears.rb', line 19 def self.subject(name, &block) if subjects.any? { |sub| sub.name == name } raise Pears::Error.new("subject name #{name} is already in use.") end Subject.new(name, loader: block).tap { |sub| @subjects.push sub } end |
.subjects ⇒ Object
14 15 16 |
# File 'lib/pears.rb', line 14 def self.subjects @subjects ||= [] end |