Class: BerkeleyLibrary::TIND::API::Format

Inherits:
TypesafeEnum::Base
  • Object
show all
Defined in:
lib/berkeley_library/tind/api/format.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ensure_format(format) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
27
# File 'lib/berkeley_library/tind/api/format.rb', line 19

def ensure_format(format)
  return unless format
  return format if format.is_a?(Format)

  fmt = Format.find_by_value(format.to_s.downcase)
  return fmt if fmt

  raise ArgumentError, "Unknown #{Format}: #{format.inspect}"
end

Instance Method Details

#to_sObject



9
10
11
12
# File 'lib/berkeley_library/tind/api/format.rb', line 9

def to_s
  # noinspection RubyYardReturnMatch
  value
end

#to_strObject



14
15
16
# File 'lib/berkeley_library/tind/api/format.rb', line 14

def to_str
  value
end