class PIM::ValidationRule
Attributes
attributes[RW]
dependent_attributes[RW]
disabled_block[RW]
name[RW]
validation_block[RW]
Public Class Methods
new(name, opts = {})
click to toggle source
# File pim.rb, line 9317 def initialize name, opts = {}, &validation_block @name = name @attributes = (PIM.symbolized_array(PIM.get_value(opts, :attributes)) || Set.new).to_set @dependent_attributes = (PIM.symbolized_array(PIM.get_value(opts, :dependent_attributes)) || Set.new).to_set @tags = PIM.stringified_array(PIM.get_value(opts, :tags)) @tags = @tags.to_set unless @tags.nil? @disabled_block = PIM.get_value(opts, :disabled_block) @validation_block = validation_block end
Public Instance Methods
depend_on()
click to toggle source
# File pim.rb, line 9340 def depend_on dependent_attributes end
Also aliased as: depends_on
disabled?(context)
click to toggle source
# File pim.rb, line 9327 def disabled? context return @disabled_block.call(context) if @disabled_block return false end
execute(context)
click to toggle source
# File pim.rb, line 9332 def execute context @validation_block.call(context) end
validate_attributes()
click to toggle source
# File pim.rb, line 9336 def validate_attributes attributes end