Module: Torm
- Extended by:
- Tools
- Defined in:
- lib/torm.rb,
lib/torm/version.rb,
lib/torm/rules_engine.rb
Defined Under Namespace
Modules: Tools Classes: RulesEngine
Constant Summary collapse
- VERSION =
'0.3.0'
Class Attribute Summary collapse
-
.default_rules_file ⇒ String
Path where the default rules can be stored.
-
.instance ⇒ Torm::RulesEngine
Singleton RulesEngine.
Class Method Summary collapse
-
.set_defaults(engine: instance) {|Torm::RulesEngine| ... } ⇒ Object
Load an engine with the current rules, yield it (to add rules) and then save it if rules were added.
Methods included from Tools
atomic_save, slice, symbolize_keys
Class Attribute Details
.default_rules_file ⇒ String
Returns Path where the default rules can be stored.
23 24 25 |
# File 'lib/torm.rb', line 23 def default_rules_file @default_rules_file ||= File.('tmp/rules.json') end |
.instance ⇒ Torm::RulesEngine
Returns Singleton RulesEngine.
18 19 20 |
# File 'lib/torm.rb', line 18 def instance @instance ||= RulesEngine.load || RulesEngine.new end |
Class Method Details
.set_defaults(engine: instance) {|Torm::RulesEngine| ... } ⇒ Object
Load an engine with the current rules, yield it (to add rules) and then save it if rules were added.
30 31 32 33 |
# File 'lib/torm.rb', line 30 def set_defaults(engine: instance) yield engine engine.save if engine.dirty? end |