Class: ActiveScaffold::DataStructures::ErrorMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/active_scaffold/data_structures/error_message.rb

Overview

Wrapper for error strings so that they may be exported using to_xxx

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ ErrorMessage

Returns a new instance of ErrorMessage.



4
5
6
# File 'lib/active_scaffold/data_structures/error_message.rb', line 4

def initialize(error)
  @error = error
end

Instance Method Details

#public_attributesObject



8
9
10
# File 'lib/active_scaffold/data_structures/error_message.rb', line 8

def public_attributes
  { :error => @error }
end

#to_sObject



20
21
22
# File 'lib/active_scaffold/data_structures/error_message.rb', line 20

def to_s
  @error
end

#to_xmlObject



12
13
14
# File 'lib/active_scaffold/data_structures/error_message.rb', line 12

def to_xml
  public_attributes.to_xml(:root => "errors")
end

#to_yamlObject



16
17
18
# File 'lib/active_scaffold/data_structures/error_message.rb', line 16

def to_yaml
  public_attributes.to_yaml
end