light_rules_engine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +30 -0
- data/.simplecov +15 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/Guardfile +11 -0
- data/README.md +103 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/light_rules_engine.rb +29 -0
- data/lib/light_rules_engine/base_rule.rb +10 -0
- data/lib/light_rules_engine/conditions_applicable_checker.rb +25 -0
- data/lib/light_rules_engine/config.rb +15 -0
- data/lib/light_rules_engine/data_container_builder.rb +8 -0
- data/lib/light_rules_engine/data_provider.rb +46 -0
- data/lib/light_rules_engine/operator_contxt.rb +32 -0
- data/lib/light_rules_engine/operators.rb +21 -0
- data/lib/light_rules_engine/operators/all.rb +9 -0
- data/lib/light_rules_engine/operators/any.rb +9 -0
- data/lib/light_rules_engine/operators/eq.rb +9 -0
- data/lib/light_rules_engine/operators/gt.rb +9 -0
- data/lib/light_rules_engine/operators/lt.rb +9 -0
- data/lib/light_rules_engine/operators/range.rb +12 -0
- data/lib/light_rules_engine/value_resolver.rb +36 -0
- data/lib/light_rules_engine/version.rb +3 -0
- data/light_rules_engine.gemspec +39 -0
- metadata +227 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3bfa3d5ac61a6d04b05c5e29863c1e4c46f4677a
|
4
|
+
data.tar.gz: 07871fc19d1baf084750fdfb572d5650149b5ed5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 642d487ab1f4453253e8ff8d5ff8db421bfb04fc8b9845f445849de7a5d2d75ce6d800dfbeac70c3bef76f54ec40f902c64542cc7eff90eff32391c00818925e
|
7
|
+
data.tar.gz: 508868a0d2a33a23fc74f4f0ee3436ff568e885bb5c83344e73c59f7db0d36d317f66af457ef0b7cebb8751cd69489ee09476d3562b2a1036e335a6f19f37a53
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
Style/Documentation:
|
3
|
+
Enabled: false
|
4
|
+
|
5
|
+
Style/PercentLiteralDelimiters:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Style/TrailingBlankLines:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/TrivialAccessors:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/UnneededPercentQ:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Documentation:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/LineLength:
|
21
|
+
Max: 120
|
22
|
+
|
23
|
+
Style/FrozenStringLiteralComment:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
AllCops:
|
27
|
+
Exclude:
|
28
|
+
- '**/Guardfile'
|
29
|
+
- '**/light_rules_engine.gemspec'
|
30
|
+
TargetRubyVersion: 2.3
|
data/.simplecov
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This is the global configuration file of the SimpleCov gem.
|
2
|
+
# More on: https://github.com/colszowka/simplecov#configuring-simplecov
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
require 'simplecov-console'
|
6
|
+
require 'simplecov-json'
|
7
|
+
|
8
|
+
SimpleCov.start 'rails' do
|
9
|
+
add_filter '/spec/'
|
10
|
+
add_filter '/config/'
|
11
|
+
formatter SimpleCov::Formatter::MultiFormatter[
|
12
|
+
SimpleCov::Formatter::Console,
|
13
|
+
SimpleCov::Formatter::JSONFormatter
|
14
|
+
]
|
15
|
+
end
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at p.niemczyk@pilot.co. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
guard :rspec, cmd: 'rspec' do
|
2
|
+
watch(%r{^lib/(.+).rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
3
|
+
watch(%r{^spec/(.+).rb$}) { |m| "spec/#{m[1]}.rb" }
|
4
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
5
|
+
watch('Gemfile')
|
6
|
+
end
|
7
|
+
|
8
|
+
# guard :rubocop, all_on_start: false, cli: ['--format', 'clang'] do
|
9
|
+
# watch(/.+\.rb$/)
|
10
|
+
# watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
11
|
+
# end
|
data/README.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# LightRulesEngine
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/light_rules_engine`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'light_rules_engine'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install light_rules_engine
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Concept of light rule engine
|
26
|
+
|
27
|
+
When we need to have some kind of dynamic rules which we want to apply based on some conditions this can be a solution.
|
28
|
+
|
29
|
+
- Rule it is place holder for business decisions and conditions when we can apply them
|
30
|
+
|
31
|
+
So Rule:
|
32
|
+
|
33
|
+
```
|
34
|
+
class BookingRule < LightRulesEngine::BaseRule
|
35
|
+
end
|
36
|
+
|
37
|
+
booking = double('booking', kind: 'Hotel', room: 'single', pax: 4, items: { bed: 'double', see_view: true, windows_count: 4 })
|
38
|
+
|
39
|
+
data_container = DataContainerBuilder.build(booking, name: :booking)
|
40
|
+
conditions ={
|
41
|
+
kind: :operator,
|
42
|
+
type: :all,
|
43
|
+
values: [
|
44
|
+
{
|
45
|
+
kind: :operator,
|
46
|
+
type: :eq,
|
47
|
+
values: [
|
48
|
+
{ kind: :data, type: 'booking.kind' },
|
49
|
+
{ kind: :value, type: :string, value: 'Hotel'}
|
50
|
+
]
|
51
|
+
},
|
52
|
+
{
|
53
|
+
kind: :operator,
|
54
|
+
type: :gt,
|
55
|
+
values: [
|
56
|
+
{ kind: :data, type: 'booking.pax' },
|
57
|
+
{ kind: :value, type: :integer, value: 2 }
|
58
|
+
]
|
59
|
+
},
|
60
|
+
{
|
61
|
+
kind: :operator,
|
62
|
+
type: :any,
|
63
|
+
values: [
|
64
|
+
{
|
65
|
+
kind: :operator,
|
66
|
+
type: :eq,
|
67
|
+
values: [
|
68
|
+
{ kind: :const, type: 'DOUBLE_BED' },
|
69
|
+
{ kind: :data, type: 'booking.items[:bed]' }
|
70
|
+
]
|
71
|
+
},
|
72
|
+
{
|
73
|
+
kind: :operator,
|
74
|
+
type: :range,
|
75
|
+
values: [
|
76
|
+
{ kind: :value, type: 'integer', value: 3 },
|
77
|
+
{ kind: :value, type: 'integer', value: 12 },
|
78
|
+
{ kind: :data, type: 'booking.items[:windows_count]' }
|
79
|
+
]
|
80
|
+
}
|
81
|
+
]
|
82
|
+
}
|
83
|
+
]
|
84
|
+
}
|
85
|
+
rule = BookingRule.new(source: business_source_logic, conditions: conditions)
|
86
|
+
|
87
|
+
# true / false
|
88
|
+
LightRulesEngine.applicable_conditions?(data_container, conditions)
|
89
|
+
|
90
|
+
# list of rules which are valid
|
91
|
+
LightRulesEngine.rules_applicable?(data_container, rule)
|
92
|
+
```
|
93
|
+
|
94
|
+
## Development
|
95
|
+
|
96
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
97
|
+
|
98
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
99
|
+
|
100
|
+
## Contributing
|
101
|
+
|
102
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/light_rules_engine. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
103
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'light_rules_engine'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'light_rules_engine/version'
|
2
|
+
require 'light_rules_engine/data_provider'
|
3
|
+
require 'light_rules_engine/value_resolver'
|
4
|
+
require 'light_rules_engine/operator_contxt'
|
5
|
+
require 'light_rules_engine/operators'
|
6
|
+
require 'light_rules_engine/config'
|
7
|
+
require 'light_rules_engine/conditions_applicable_checker'
|
8
|
+
require 'light_rules_engine/data_container_builder'
|
9
|
+
require 'light_rules_engine/base_rule'
|
10
|
+
|
11
|
+
module LightRulesEngine
|
12
|
+
def self.config
|
13
|
+
@config || Config::DEFAULT_CONFIG
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.setup_config(opts = {})
|
17
|
+
@config = Config::DEFAULT_CONFIG.merge(opts)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.applicable_conditions?(data_container, conditions)
|
21
|
+
ConditionsApplicableChecker.new(data_container: data_container, conditions: conditions).applable?
|
22
|
+
end
|
23
|
+
|
24
|
+
def rules_applicable?(data_container, *rules)
|
25
|
+
rules.map do |rule|
|
26
|
+
rule if rules_applicable?(data_container, rule.conditions)
|
27
|
+
end.compact
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module LightRulesEngine
|
2
|
+
class ConditionsApplicableChecker
|
3
|
+
def initialize(data_container:, conditions:)
|
4
|
+
@data_container = data_container
|
5
|
+
@conditions = conditions
|
6
|
+
end
|
7
|
+
|
8
|
+
def applable?
|
9
|
+
return false unless conditions[:kind] == :operator
|
10
|
+
config[:operation_context_class].new(conditions, data_provider).result
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
attr_reader :data_container, :conditions
|
16
|
+
|
17
|
+
def config
|
18
|
+
@config ||= LightRulesEngine.config
|
19
|
+
end
|
20
|
+
|
21
|
+
def data_provider
|
22
|
+
@data_provider ||= config[:data_provider_class].new(data_container)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module LightRulesEngine
|
2
|
+
class Config
|
3
|
+
DEFAULT_CONSTS = {
|
4
|
+
RULE_ENGINE: 'LightRulesEngine'
|
5
|
+
}.freeze
|
6
|
+
|
7
|
+
DEFAULT_CONFIG = {
|
8
|
+
data_provider_class: LightRulesEngine::DataProvider,
|
9
|
+
operators_namespace: LightRulesEngine::Operators,
|
10
|
+
operation_context_class: LightRulesEngine::OperatorContxt,
|
11
|
+
value_resolver_class: LightRulesEngine::ValueResolver,
|
12
|
+
consts: DEFAULT_CONSTS
|
13
|
+
}.freeze
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module LightRulesEngine
|
2
|
+
class DataProvider
|
3
|
+
def initialize(data)
|
4
|
+
@data = data
|
5
|
+
end
|
6
|
+
|
7
|
+
def value_for(keyword)
|
8
|
+
send_methods(keyword).inject(data, &method(:call_chain_methods))
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
attr_reader :data
|
14
|
+
|
15
|
+
def send_methods(keyword)
|
16
|
+
keyword.split('.').compact
|
17
|
+
end
|
18
|
+
|
19
|
+
def call_chain_methods(object, method_name)
|
20
|
+
state = method_state(method_name)
|
21
|
+
return nil unless object.respond_to?(state[:method_name])
|
22
|
+
case state[:kind]
|
23
|
+
when :pure then object.public_send(state[:method_name])
|
24
|
+
when :round then object.public_send(state[:method_name], state[:arg])
|
25
|
+
when :square then object.public_send(state[:method_name]).public_send(:[], state[:arg])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def method_state(method_name)
|
30
|
+
arg_var_one = method_name[/\(.*?\)/]
|
31
|
+
arg_var_two = method_name[/\[.*?\]/]
|
32
|
+
arg = (arg_var_one || arg_var_two)
|
33
|
+
method_name = method_name.gsub!(arg.to_s, '')
|
34
|
+
return { method_name: method_name, kind: :pure } unless arg
|
35
|
+
return { method_name: method_name, kind: :square, arg: prepare_arg(arg) } if arg_var_two
|
36
|
+
{ method_name: method_name, kind: :round, arg: prepare_arg(arg) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def prepare_arg(arg)
|
40
|
+
arg.delete!("\"'[()]")
|
41
|
+
Integer(arg)
|
42
|
+
rescue
|
43
|
+
arg
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module LightRulesEngine
|
2
|
+
class OperatorContxt
|
3
|
+
def initialize(operator_hash, data_provider)
|
4
|
+
@operator_hash = operator_hash
|
5
|
+
@data_provider = data_provider
|
6
|
+
end
|
7
|
+
|
8
|
+
def operator
|
9
|
+
@operator ||= config[:operators_namespace].find(operator_hash[:type])
|
10
|
+
end
|
11
|
+
|
12
|
+
def values
|
13
|
+
operator_hash[:values].map(&method(:resolve))
|
14
|
+
end
|
15
|
+
|
16
|
+
def result
|
17
|
+
operator.result(*values)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :operator_hash, :data_provider
|
23
|
+
|
24
|
+
def resolve(value)
|
25
|
+
config[:value_resolver_class].new(data_provider: data_provider).resolve(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
def config
|
29
|
+
@config ||= LightRulesEngine.config
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'light_rules_engine/operators/all'
|
2
|
+
require 'light_rules_engine/operators/any'
|
3
|
+
require 'light_rules_engine/operators/gt'
|
4
|
+
require 'light_rules_engine/operators/lt'
|
5
|
+
require 'light_rules_engine/operators/eq'
|
6
|
+
require 'light_rules_engine/operators/range'
|
7
|
+
|
8
|
+
module LightRulesEngine
|
9
|
+
module Operators
|
10
|
+
def self.find(name)
|
11
|
+
class_name = classify_string(name.to_s)
|
12
|
+
self.const_get(class_name)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.classify_string(string)
|
16
|
+
string = string.sub(/^[a-z\d]*/) { $&.capitalize }
|
17
|
+
string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
|
18
|
+
string.sub(/.*\./, '')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module LightRulesEngine
|
2
|
+
class ValueResolver
|
3
|
+
def initialize(data_provider:)
|
4
|
+
@data_provider = data_provider
|
5
|
+
end
|
6
|
+
|
7
|
+
def resolve(value)
|
8
|
+
kind = value[:kind]
|
9
|
+
send("process_#{kind}", value)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :data_provider
|
15
|
+
|
16
|
+
def process_operator(value)
|
17
|
+
config[:operation_context_class].new(value, data_provider).result
|
18
|
+
end
|
19
|
+
|
20
|
+
def process_data(value)
|
21
|
+
data_provider.value_for(value[:type])
|
22
|
+
end
|
23
|
+
|
24
|
+
def process_const(value)
|
25
|
+
config[:consts][value[:value]]
|
26
|
+
end
|
27
|
+
|
28
|
+
def process_value(value)
|
29
|
+
value[:value]
|
30
|
+
end
|
31
|
+
|
32
|
+
def config
|
33
|
+
@config ||= LightRulesEngine.config
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'light_rules_engine/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'light_rules_engine'
|
8
|
+
spec.version = LightRulesEngine::VERSION
|
9
|
+
spec.authors = ['Pawel Niemczyk']
|
10
|
+
spec.email = ['pniemczyk@o2.pl']
|
11
|
+
spec.license = 'MIT'
|
12
|
+
|
13
|
+
spec.summary = 'Rules Engine'
|
14
|
+
spec.description = 'Gem is a foundation of rule engine'
|
15
|
+
spec.homepage = 'https://github.com/pniemczyk/light_rules_engine'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
# raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'guard', '~> 2.14'
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.40'
|
32
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
33
|
+
spec.add_development_dependency 'guard-rubocop', '~> 1.2'
|
34
|
+
spec.add_development_dependency 'awesome_print', '~> 1.6'
|
35
|
+
|
36
|
+
spec.add_development_dependency 'simplecov', '~> 0.9'
|
37
|
+
spec.add_development_dependency 'simplecov-console', '~> 0.2'
|
38
|
+
spec.add_development_dependency 'simplecov-json', '~> 0.2'
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,227 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: light_rules_engine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pawel Niemczyk
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.14'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.14'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.40'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.40'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.5'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.5'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.2'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: awesome_print
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.6'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.6'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.9'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.9'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov-console
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.2'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.2'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov-json
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.2'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.2'
|
167
|
+
description: Gem is a foundation of rule engine
|
168
|
+
email:
|
169
|
+
- pniemczyk@o2.pl
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".gitignore"
|
175
|
+
- ".rspec"
|
176
|
+
- ".rubocop.yml"
|
177
|
+
- ".simplecov"
|
178
|
+
- ".travis.yml"
|
179
|
+
- CODE_OF_CONDUCT.md
|
180
|
+
- Gemfile
|
181
|
+
- Guardfile
|
182
|
+
- README.md
|
183
|
+
- Rakefile
|
184
|
+
- bin/console
|
185
|
+
- bin/setup
|
186
|
+
- lib/light_rules_engine.rb
|
187
|
+
- lib/light_rules_engine/base_rule.rb
|
188
|
+
- lib/light_rules_engine/conditions_applicable_checker.rb
|
189
|
+
- lib/light_rules_engine/config.rb
|
190
|
+
- lib/light_rules_engine/data_container_builder.rb
|
191
|
+
- lib/light_rules_engine/data_provider.rb
|
192
|
+
- lib/light_rules_engine/operator_contxt.rb
|
193
|
+
- lib/light_rules_engine/operators.rb
|
194
|
+
- lib/light_rules_engine/operators/all.rb
|
195
|
+
- lib/light_rules_engine/operators/any.rb
|
196
|
+
- lib/light_rules_engine/operators/eq.rb
|
197
|
+
- lib/light_rules_engine/operators/gt.rb
|
198
|
+
- lib/light_rules_engine/operators/lt.rb
|
199
|
+
- lib/light_rules_engine/operators/range.rb
|
200
|
+
- lib/light_rules_engine/value_resolver.rb
|
201
|
+
- lib/light_rules_engine/version.rb
|
202
|
+
- light_rules_engine.gemspec
|
203
|
+
homepage: https://github.com/pniemczyk/light_rules_engine
|
204
|
+
licenses:
|
205
|
+
- MIT
|
206
|
+
metadata: {}
|
207
|
+
post_install_message:
|
208
|
+
rdoc_options: []
|
209
|
+
require_paths:
|
210
|
+
- lib
|
211
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
221
|
+
requirements: []
|
222
|
+
rubyforge_project:
|
223
|
+
rubygems_version: 2.5.1
|
224
|
+
signing_key:
|
225
|
+
specification_version: 4
|
226
|
+
summary: Rules Engine
|
227
|
+
test_files: []
|