Class: Calculus::ManureManagementPlan::Method
- Inherits:
-
Object
- Object
- Calculus::ManureManagementPlan::Method
- Defined in:
- lib/calculus/manure_management_plan/method.rb
Direct Known Subclasses
Instance Method Summary collapse
- #compute ⇒ Object
-
#crop_sets ⇒ Object
Returns matching crop set for the given variety.
- #estimate_expected_yield ⇒ Object
-
#initialize(options = {}) ⇒ Method
constructor
A new instance of Method.
- #production ⇒ Object
- #soil_natures ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Method
Returns a new instance of Method.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/calculus/manure_management_plan/method.rb', line 4 def initialize( = {}) @options = @variety = [:variety] @support = [:support] @opened_at = [:opened_at] @usage = [:production_usage] @soil_nature = [:soil_nature] @cultivation = [:cultivation] @expected_yield = [:expected_yield] || 0.0.in_kilogram_per_square_meter end |
Instance Method Details
#compute ⇒ Object
42 43 44 |
# File 'lib/calculus/manure_management_plan/method.rb', line 42 def compute raise NotImplemented end |
#crop_sets ⇒ Object
Returns matching crop set for the given variety
28 29 30 31 32 33 34 35 36 |
# File 'lib/calculus/manure_management_plan/method.rb', line 28 def crop_sets return [] unless @variety @crop_sets ||= Nomen::CropSet.list.select do |i| i.varieties.detect do |v| @variety <= v end end @crop_sets end |
#estimate_expected_yield ⇒ Object
38 39 40 |
# File 'lib/calculus/manure_management_plan/method.rb', line 38 def estimate_expected_yield raise NotImplemented end |
#production ⇒ Object
19 20 21 |
# File 'lib/calculus/manure_management_plan/method.rb', line 19 def production @support.activity end |
#soil_natures ⇒ Object
23 24 25 |
# File 'lib/calculus/manure_management_plan/method.rb', line 23 def soil_natures @soil_natures ||= (@options[:soil_nature] ? @options[:soil_nature].self_and_parents : [:undefined]) end |