README.txt in amee-data-abstraction-2.1.1 vs README.txt in amee-data-abstraction-2.2.0
- old
+ new
@@ -23,13 +23,13 @@
* rubygems >= 1.5
All gem requirements should be installed as part of the rubygems installation process
above, but are listed here for completeness.
- * amee ~> 3.0
+ * amee ~> 4.1
* uuidtools = 2.1.2
- * quantify = 1.1.0
+ * quantify = 2.0.0
== USAGE
The library provides several useful functions:
@@ -115,21 +115,15 @@
=== Configuring mutliple application calculation prototypes
Typical practice is initialize the calculation prototypes required for an
application via a configuration file which creates the required calculation
-templates within an instance of CalculationSet. If the calculation set is assigned
-to a global variable or constant, the set of prototypes is available for
-initializing new calculations and templating view structures (e.g. tables, forms)
-from anywhere in the application.
+templates within an instance of CalculationSet. Such a configuration file can
+be structured the follow DSL:
-Adding a configuration to /config or /config/initializers may be appropriate
+ # e.g. /config/calculations/my_emissions_calculations.rb
- # e.g. /config/initializers/calculations.rb
-
- Calculations = AMEE::DataAbstraction::CalculationSet {
-
calculation {
label :electricity
name "Grid Electricity Supply"
path "/some/electricity/associated/path/in/amee"
terms_from_amee
@@ -146,20 +140,38 @@
label :fuel
name "Fuel Consumption"
path "/some/fuel/associated/path/in/amee"
terms_from_amee
}
- }
+The default location for such files within Rails applications is under
+/config/calculations. If such an approach is taken, the configuration can be
+read and a calculation set generated by using the filename, thus:
+
+ CalculationSet.find('my_emissions_calculations')
+
#=> <AMEE::DataAbstraction::CalculationSet ... >
+Otherwise, the path to the configuration file can be provided:
+
+ CalculationSet.find('some/directory/my_emissions_calculations')
+
+ #=> <AMEE::DataAbstraction::CalculationSet ... >
+
+The calculation set is accessible as follow using the same argument as used
+by the Find method (filename if conventional Rails location, path otherwise):
+
+ CalculationSet.sets['my_emissions_calculations']
+
+ #=> <AMEE::DataAbstraction::CalculationSet ... >
+
From this global calculation set, initialize a new calculation
- my_fuel_calculation = Calculations[:fuel].begin_calculation
+ my_fuel_calculation = CalculationSet.sets['my_emissions_calcualtions'][:fuel].begin_calculation
#=> <AMEE::DataAbstraction::OngoingCalculation ... >
- a_different_transport_calculation = Calculations[:transport].begin_calculation
+ a_different_transport_calculation = CalculationSet.sets['my_emissions_calcualtions'][:transport].begin_calculation
#=> <AMEE::DataAbstraction::OngoingCalculation ... >
=== Configuring a connection to AMEE