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



18
19
20
# File 'lib/active_scaffold/data_structures/error_message.rb', line 18

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