Sha256: 4d04f26dc3b989712c9417c931eeff93107c1fcccc64c1552ba9e229c923be15
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 KB
Contents
module Sbuilder class ResolverRuleMatch < ResolverRule attr_reader :matchRule # string or regexp attr_reader :domain # ------------------------------------------------------------------ # mixer PROGNAME = "ResolverRuleMatch" # progname for logger include Sbuilder::Utils::MyLogger # mix logger # ------------------------------------------------------------------ # constrcutore def initialize( options = {} ) @logger = getLogger( PROGNAME, options ) @logger.debug( "#{__method__} initialized" ) super( options ) end # set properties when loading def config( matchRule, domain ) @matchRule = matchRule @domain = domain end # ------------------------------------------------------------------ # resolve domain def match( parameter ) matchRule.is_a?( String ) ? parameter.name == matchRule : (parameter.name =~ matchRule) != nil end # return true if domain resolved def doApplyRule( parameter, model ) @logger.debug( "#{__method__} matchRule=#{matchRule}, matchRule.class=#{matchRule.class} on parameter.getName=#{parameter.getName}" ) # no need to resolve domain - Paramter_Ref? return true unless parameter.respond_to?( :domain ) # its already read return true if parameter.domain if match( parameter ) then @logger.info( "#{__method__} setDomain '#{domain}' on parameter '#{parameter.getName}' based on rule '#{matchRule}'" ) # parameter.setDomain( domain ) parameter.resolveDomain( model ) return true end return false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tla-sbuilder-0.2.2 | lib/sbuilder/resolver_rule_match.rb |
tla-sbuilder-0.2.1 | lib/sbuilder/resolver_rule_match.rb |