Module: Dat::Science
- Defined in:
- lib/dat/science.rb,
lib/dat/science/result.rb,
lib/dat/science/experiment.rb
Overview
Public: Include this module if you like science.
Defined Under Namespace
Classes: Experiment, Result
Class Method Summary collapse
-
.experiment ⇒ Object
Public: The Class to use for all ‘science` experiments.
-
.experiment=(klass) ⇒ Object
Public: Set the Class to use for all ‘science` experiments.
-
.reset ⇒ Object
Internal: Reset any static configuration (primarily ‘Dat::Science.experiment`. Returns `self`..
Instance Method Summary collapse
-
#science(name, &block) ⇒ Object
Public: Do some science.
Class Method Details
.experiment ⇒ Object
Public: The Class to use for all ‘science` experiments. Default is `Dat::Science::Experiment`.
15 16 17 |
# File 'lib/dat/science.rb', line 15 def self.experiment @experiment ||= Dat::Science::Experiment end |
.experiment=(klass) ⇒ Object
Public: Set the Class to use for all ‘science` experiments. Returns `klass`.
21 22 23 |
# File 'lib/dat/science.rb', line 21 def self.experiment=(klass) @experiment = klass end |
.reset ⇒ Object
Internal: Reset any static configuration (primarily ‘Dat::Science.experiment`. Returns `self`.
27 28 29 30 31 |
# File 'lib/dat/science.rb', line 27 def self.reset @experiment = nil self end |
Instance Method Details
#science(name, &block) ⇒ Object
Public: Do some science.
9 10 11 |
# File 'lib/dat/science.rb', line 9 def science(name, &block) Science.experiment.new(name, &block).run end |