Class: XRay::JS::Rule::All
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- XRay::JS::Rule::All
- Defined in:
- lib/js/rule/all.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ All
constructor
A new instance of All.
- #load_sub_rules ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ All
11 12 13 14 15 16 17 18 19 |
# File 'lib/js/rule/all.rb', line 11 def initialize( = {}) @rules = load_sub_rules.collect do |name| klass = Rule.const_get name klass.method(:initialize).arity >= 1 ? klass.new() : klass.new end super @rules end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
9 10 11 |
# File 'lib/js/rule/all.rb', line 9 def rules @rules end |
Instance Method Details
#load_sub_rules ⇒ Object
21 22 23 24 25 26 |
# File 'lib/js/rule/all.rb', line 21 def load_sub_rules Dir.glob File.( '*.rb', File.dirname(__FILE__) ) do |file| require file end XRay::JS::Rule.constants.select { |c| c.to_s.end_with? 'Rule' } end |