Class: Resourceful::Resource::Format
- Inherits:
-
Object
- Object
- Resourceful::Resource::Format
- Defined in:
- lib/resourceful/resource/format.rb
Constant Summary collapse
- SUPPORTED =
['json', 'xml']
Class Method Summary collapse
Class Method Details
.build(str) ⇒ Object
30 31 32 |
# File 'lib/resourceful/resource/format.rb', line 30 def build(str) raise 'method not implemented by this format' end |
.get(format) ⇒ Object
13 14 15 16 |
# File 'lib/resourceful/resource/format.rb', line 13 def get(format) raise Resourceful::Exceptions::FormatError, "the format '#{format}' is not supported" unless SUPPORTED.include?(format.to_s) self.send(format) end |
.json ⇒ Object
18 19 20 |
# File 'lib/resourceful/resource/format.rb', line 18 def json Resourceful::Resource::Json end |
.to_s ⇒ Object
26 27 28 |
# File 'lib/resourceful/resource/format.rb', line 26 def to_s raise 'method not implemented by this format' end |
.xml ⇒ Object
22 23 24 |
# File 'lib/resourceful/resource/format.rb', line 22 def xml Resourceful::Resource::Xml end |