Module: Objective::Unit::ClassMethods
- Defined in:
- lib/objective/unit.rb
Instance Method Summary collapse
Instance Method Details
#filter(&block) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/objective/unit.rb', line 15 def filter(&block) root_filter.filter(&block) root_filter.keys.each do |key| define_method(key) { inputs[key] } end end |
#root_filter ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/objective/unit.rb', line 22 def root_filter @root_filter ||= if superclass.respond_to?(:root_filter) superclass.root_filter.dup else Objective::Filters::RootFilter.new end end |
#run(*args) ⇒ Object
31 32 33 |
# File 'lib/objective/unit.rb', line 31 def run(*args) new.run(*args) end |
#run!(*args) ⇒ Object
35 36 37 38 39 |
# File 'lib/objective/unit.rb', line 35 def run!(*args) outcome = run(*args) return outcome.result if outcome.success raise Objective::ValidationError, outcome.errors end |