Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/amee.rb

Instance Method Summary collapse

Instance Method Details

#is_json?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/amee.rb', line 23

def is_json?
  slice(0,1) == '{'
end

#is_v2_atom?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/amee.rb', line 35

def is_v2_atom?
  is_xml? && (include?('<feed ') || include?('<entry ')) && include?('xmlns:amee="http://schemas.amee.cc/2.0"')
end

#is_v2_json?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/amee.rb', line 26

def is_v2_json?
  is_json? && match('"apiVersion"\s?:\s?"2.0"')
end

#is_v2_xml?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/amee.rb', line 32

def is_v2_xml?
  is_xml? && include?('<Resources xmlns="http://schemas.amee.cc/2.0">')
end

#is_xml?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/amee.rb', line 29

def is_xml?
  slice(0,5) == '<?xml'
end