Class: BootstrapValidatorRails::Validators::Generator
- Inherits:
-
Object
- Object
- BootstrapValidatorRails::Validators::Generator
- Defined in:
- lib/bootstrap_validator_rails/validators/generator.rb
Instance Method Summary collapse
- #generate_html_attributes ⇒ Object
- #generate_js_options ⇒ Object
-
#initialize(record, validator, method) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(record, validator, method) ⇒ Generator
Returns a new instance of Generator.
4 5 6 7 |
# File 'lib/bootstrap_validator_rails/validators/generator.rb', line 4 def initialize(record, validator, method) @record, @validator, @method = record, validator, method @kind = validator.kind end |
Instance Method Details
#generate_html_attributes ⇒ Object
9 10 11 12 13 14 |
# File 'lib/bootstrap_validator_rails/validators/generator.rb', line 9 def generate_html_attributes return {} unless VALIDATOR_SUPPORTED.include?(@kind) klass = "BootstrapValidatorRails::Validators::#{@kind.to_s.capitalize}".constantize bootstrap_validator = klass.new(@record, @method, @validator) bootstrap_validator.html_attributes end |
#generate_js_options ⇒ Object
16 17 18 19 20 21 |
# File 'lib/bootstrap_validator_rails/validators/generator.rb', line 16 def return {} unless VALIDATOR_SUPPORTED.include?(@kind) klass = "BootstrapValidatorRails::Validators::#{@kind.to_s.capitalize}".constantize bootstrap_validator = klass.new(@record, @method, @validator) bootstrap_validator. end |