Sha256: 9af4c3b311bb9bb88787ff286d34cd6d510a0ecc707b7c3ecf5e55ca2c616847
Contents?: true
Size: 488 Bytes
Versions: 2
Compression:
Stored size: 488 Bytes
Contents
#!/usr/bin/env ruby require "rubygems" require "json" require "sinatra" require "nameable" get '/*/*.*' do |raw_name, function, type| begin name = Nameable::Latin.new.parse(raw_name) rescue Nameable::Latin::InvalidNameError => e "" end if type.to_sym == :json content_type 'application/json' name.to_hash.to_json else content_type 'text/plain' name.send("to_#{function}") if function =~ /^(fullname|nameable|firstname|lastname|middlename)$/ end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nameable-0.5.1 | examples/nameable_web_service.rb |
nameable-0.5.0 | examples/nameable_web_service.rb |