Exception: Fortitude::Errors::InvalidElementAttributes

Inherits:
Base
  • Object
show all
Defined in:
lib/fortitude/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(widget, tag, invalid_attributes_hash, allowed_attribute_names) ⇒ InvalidElementAttributes

Returns a new instance of InvalidElementAttributes.



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fortitude/errors.rb', line 68

def initialize(widget, tag, invalid_attributes_hash, allowed_attribute_names)
  message = %{The widget #{widget} tried to render an element, <#{tag.name}>, with attributes that are not allowed: #{invalid_attributes_hash.inspect}. Only these attributes are allowed: #{allowed_attribute_names.sort_by(&:to_s).inspect}}
  if tag.spec
    message << " (See '#{tag.spec}' for more details.)"
  end

  super(message)
  @widget = widget
  @tag = tag
  @invalid_attributes_hash = invalid_attributes_hash
  @allowed_attribute_names = allowed_attribute_names
end

Instance Attribute Details

#allowed_attribute_namesObject (readonly)

Returns the value of attribute allowed_attribute_names.



66
67
68
# File 'lib/fortitude/errors.rb', line 66

def allowed_attribute_names
  @allowed_attribute_names
end

#invalid_attributes_hashObject (readonly)

Returns the value of attribute invalid_attributes_hash.



66
67
68
# File 'lib/fortitude/errors.rb', line 66

def invalid_attributes_hash
  @invalid_attributes_hash
end

#widgetObject (readonly)

Returns the value of attribute widget.



66
67
68
# File 'lib/fortitude/errors.rb', line 66

def widget
  @widget
end

Instance Method Details

#tag_nameObject



81
82
83
# File 'lib/fortitude/errors.rb', line 81

def tag_name
  @tag.name
end