Last active
December 15, 2015 10:29
-
-
Save jonpaul/5246508 to your computer and use it in GitHub Desktop.
inheritance!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mde | |
def match_for_mde(mde, arclass_id, arclass_filename) | |
rule = Parser.new(mde) | |
es_query = Bar.new(rule, arclass_id, arclass_filename).es_query | |
rest_call_for_truth(es_query) | |
end | |
def rest_call_for_truth(query) | |
res = rest_client_stuff(query.to_json) | |
if res == 'condition' | |
true | |
else | |
false | |
end | |
end | |
class QueryBuilder | |
def initialize(rule, analysis_id, filename) | |
self.rule = rule | |
# . | |
# . | |
# . | |
# more attr assignment | |
# and generation of rule hash | |
end | |
end | |
class Parser | |
def initialize(rule) | |
some_method_to_produce_rule(rule) | |
end | |
end | |
end | |
module MdeManager | |
module Glue | |
def self.included(base) | |
base.send :include, Foo | |
end | |
end | |
end | |
class ARClass | |
include MdeManager::Glue | |
end | |
class AWorkerSomewhere | |
def self.perform(analysis_id) | |
analysis = ARClass.find(analysis_id) | |
rules = MDE_Rules.all | |
rules.each do |rule| | |
if analysis.match_for_mde(rule, analysis.id, analysis.filename) | |
analysis.mdr_match(rule) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment