Class: ModelErrorMessages::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/model_error_messages/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
12
# File 'lib/model_error_messages/configuration.rb', line 9

def initialize
  reset
  true
end

Instance Attribute Details

#append_htmlObject

Returns the value of attribute append_html.



5
6
7
# File 'lib/model_error_messages/configuration.rb', line 5

def append_html
  @append_html
end

#classesObject

Returns the value of attribute classes.



6
7
8
# File 'lib/model_error_messages/configuration.rb', line 6

def classes
  @classes
end

#configuration=(value) ⇒ Object (writeonly)

Sets the attribute configuration

Parameters:

  • value

    the value to set the attribute configuration to.



7
8
9
# File 'lib/model_error_messages/configuration.rb', line 7

def configuration=(value)
  @configuration = value
end

#prepend_htmlObject

Returns the value of attribute prepend_html.



4
5
6
# File 'lib/model_error_messages/configuration.rb', line 4

def prepend_html
  @prepend_html
end

#single_error_in_paragraphObject

Returns the value of attribute single_error_in_paragraph.



3
4
5
# File 'lib/model_error_messages/configuration.rb', line 3

def single_error_in_paragraph
  @single_error_in_paragraph
end

Instance Method Details

#resetObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/model_error_messages/configuration.rb', line 14

def reset
  @single_error_in_paragraph = true
  @prepend_html = ''
  @append_html = ''
  @classes = lambda do |model|
    [
      'alert',
      'alert-danger',
      model.class.model_name.param_key + '-error-messages'
    ].join(' ')
  end
end