Class: Formalist::Validation::CollectionRulesCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/formalist/validation/collection_rules_compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_name) ⇒ CollectionRulesCompiler

Returns a new instance of CollectionRulesCompiler.



6
7
8
# File 'lib/formalist/validation/collection_rules_compiler.rb', line 6

def initialize(target_name)
  @target_name = target_name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)



60
61
62
# File 'lib/formalist/validation/collection_rules_compiler.rb', line 60

def method_missing(name, *args)
  []
end

Instance Attribute Details

#target_nameObject (readonly)

Returns the value of attribute target_name.



4
5
6
# File 'lib/formalist/validation/collection_rules_compiler.rb', line 4

def target_name
  @target_name
end

Instance Method Details

#call(ast) ⇒ Object



10
11
12
# File 'lib/formalist/validation/collection_rules_compiler.rb', line 10

def call(ast)
  ast.map { |node| visit(node) }.reduce([], :concat).each_slice(2).to_a
end