Skip to content

Commit

Permalink
Bump to 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rderoldan1 committed Aug 5, 2013
1 parent d1fe0eb commit 4140cea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion lib/rails_country_select.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# encoding: utf-8
require "rails_country_select/version"

require File.expand_path('../country_definitions', __FILE__)

if defined?(Rails) && defined?(ActionView)
module ActionView
module Helpers
autoload :CountryHelper, 'rails_country_select/helpers/rails_country_select'
module FormOptionsHelper
def country_select(object, method, options = {}, html_options = {})
options[:keys] = :names unless options.has_key?(:keys)
Expand All @@ -27,6 +28,17 @@ def country_select(method, options = {}, html_options = {})
@template.country_select(@object_name, method, options.merge({:object => @object}), html_options)
end
end

# get country info given some params
def country(options = {:name => "", :num =>"", :alpha2s => "", :alpha3s => ""})
result = []
COUNTRY_NUMS.zip(COUNTRY_NAMES, COUNTRY_ALPHA2S, COUNTRY_ALPHA3S).each do |country|
if options[:nums].to_i.eql?(country[0]) || options[:name].eql?(country[1]) || options[:alpha2s].eql?(country[2]) || options[:alpha3s].eql?(country[3])
result = country
end
end
result
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rails_country_select/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RailsCountrySelect
VERSION = "0.0.1"
VERSION = "0.1.0"
end

0 comments on commit 4140cea

Please sign in to comment.