gem 'httpclient'
gem 'SystemTimer', '>= 1.1.3', :require => 'system_timer'
gem 'sanitize'
+gem 'rails-i18n-updater'
# Should only load if memcache is in use
gem 'memcached'
+++ /dev/null
-.DS_Store
-Icon?
-._*
+++ /dev/null
-h1. Rails Locale Data Repository
-
-Central point to collect locale data for use in Ruby on Rails.
-
-To contribute just send me a pull request, patch or plain text file.
-
-Please include a comment with the language/locale name and your name and email address (or other contact information like your github profile) to the locale file so people can come contact you and ask questions etc.
-
-Also, please pay attention to save your files as UTF-8.
-
-h2. Rails translations plugin
-
-To include the translations of this repository into your application, simply install it as a plugin:
-
-./script/plugin install git://github.com/zargony/rails-i18n.git
-
-The plugin will load Rails core translations of locales you are using in your app. (i.e. if you have en.yml, de.yml and fr.yml in config/locales, Rails core locales for :de and :fr are added). These translations are added to the I18n load path before application locales, so you can still override them in your application locales.
-
-h2. Rails translations
-
-Simple tool for testing the integrity of your key structure:
-
-Make sure you have the Ruby I18n gem installed. If you haven't already you can try:
-
-sudo gem install svenfuchs-i18n -s http://gems.github.com
-
-Then, standing in the root directory of this repository, do:
-
-ruby test/structure.rb [your-locale]
-
-Assuming that there is a file locale/[your-locale].{rb,yml} you will get a summary of missing and bogus keys as well as extra pluralization keys in your locale data.
-
-h2. Rails I18n Textmate bundle
-
-Still in a very experimental state but already helpful for me.
-
-The bundle adds a single command: extract translation (shift-cmd-e)
-
-# expects you to have a string selected (including single or double quotes)
-# prompts you for a dot-separated key
-# opens the file /log/translations.yml (creating it when not available)
-# adds the translation (mapping the dot-separated key to nested yaml keys)
-# replaces the selected string in your source-code with the dot-separated key wrapped into a call to t(your.key)
-
-It currently expects that you're working with English views, so it uses :en as a locale in translation.yml.
-
-Note that Textmate, while active, won't reload the translations.yml for you if it's already open. When you give the focus to another application and then go back to Textmate (e.g. with cmd-tab, cmd-tab) it will reload the file. I found it useful to have translations.yml open on a second monitor while extracting translations from my application.
-
-I still have to figure out how to automatically select the next string after this command has run. It works well to just use Textmate's "Find Next" though:
-
-# hit cmd-f and give it <code>("|').*(\1)</code> as a search expression, tell it to use this as a "Regular expression"
-# hit return and it will select the next string
-# use shift-cmd-e to extract that string
-# hit cmd-g to select the next string
-
+++ /dev/null
-# Rails plugin initialization: add default locales to I18n.load_path
-# - only add locales that are actually used in the application
-# - prepend locales so that they can be overwritten by the application
-#
-# We do this after_initialize as the I18n.load_path might be modified
-# in a config/initializers/initializer.rb
-class Rails::Initializer #:nodoc:
- def after_initialize_with_translations_import
- after_initialize_without_translations_import
- used_locales = I18n.load_path.map { |f| File.basename(f).gsub(/\.(rb|yml)$/, '') }.uniq
- files_to_add = Dir[File.join(File.dirname(__FILE__), 'locale', "{#{used_locales.join(',')}}.{rb,yml}")]
- I18n.load_path.unshift(*files_to_add)
- end
- alias_method_chain :after_initialize, :translations_import
-end
+++ /dev/null
-"en":
- number:
- # Used in number_with_delimiter()
- # These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
- format:
- # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
- separator: "."
- # Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
- delimiter: ","
- # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
- precision: 3
-
- # Used in number_to_currency()
- currency:
- format:
- # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
- format: "%u%n"
- unit: "$"
- # These three are to override number.format and are optional
- separator: "."
- delimiter: ","
- precision: 2
-
- # Used in number_to_percentage()
- percentage:
- format:
- # These three are to override number.format and are optional
- # separator:
- delimiter: ""
- # precision:
-
- # Used in number_to_precision()
- precision:
- format:
- # These three are to override number.format and are optional
- # separator:
- delimiter: ""
- # precision:
-
- # Used in number_to_human_size()
- human:
- format:
- # These three are to override number.format and are optional
- # separator:
- delimiter: ""
- precision: 1
- storage_units:
- # Storage units output formatting.
- # %u is the storage unit, %n is the number (default: 2 MB)
- format: "%n %u"
- units:
- byte:
- one: "Byte"
- other: "Bytes"
- kb: "KB"
- mb: "MB"
- gb: "GB"
- tb: "TB"
-
- # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
- datetime:
- distance_in_words:
- half_a_minute: "half a minute"
- less_than_x_seconds:
- one: "less than 1 second"
- other: "less than {{count}} seconds"
- x_seconds:
- one: "1 second"
- other: "{{count}} seconds"
- less_than_x_minutes:
- one: "less than a minute"
- other: "less than {{count}} minutes"
- x_minutes:
- one: "1 minute"
- other: "{{count}} minutes"
- about_x_hours:
- one: "about 1 hour"
- other: "about {{count}} hours"
- x_days:
- one: "1 day"
- other: "{{count}} days"
- about_x_months:
- one: "about 1 month"
- other: "about {{count}} months"
- x_months:
- one: "1 month"
- other: "{{count}} months"
- about_x_years:
- one: "about 1 year"
- other: "about {{count}} years"
- over_x_years:
- one: "over 1 year"
- other: "over {{count}} years"
- prompts:
- year: "Year"
- month: "Month"
- day: "Day"
- hour: "Hour"
- minute: "Minute"
- second: "Seconds"
-
- activerecord:
- errors:
- template:
- header:
- one: "1 error prohibited this {{model}} from being saved"
- other: "{{count}} errors prohibited this {{model}} from being saved"
- # The variable :count is also available
- body: "There were problems with the following fields:"
-
+++ /dev/null
-en:
- activerecord:
- errors:
- # The values :model, :attribute and :value are always available for interpolation
- # The value :count is available when applicable. Can be used for pluralization.
- messages:
- inclusion: "is not included in the list"
- exclusion: "is reserved"
- invalid: "is invalid"
- confirmation: "doesn't match confirmation"
- accepted: "must be accepted"
- empty: "can't be empty"
- blank: "can't be blank"
- too_long: "is too long (maximum is {{count}} characters)"
- too_short: "is too short (minimum is {{count}} characters)"
- wrong_length: "is the wrong length (should be {{count}} characters)"
- taken: "has already been taken"
- not_a_number: "is not a number"
- greater_than: "must be greater than {{count}}"
- greater_than_or_equal_to: "must be greater than or equal to {{count}}"
- equal_to: "must be equal to {{count}}"
- less_than: "must be less than {{count}}"
- less_than_or_equal_to: "must be less than or equal to {{count}}"
- odd: "must be odd"
- even: "must be even"
- # Append your own errors here or at the model/attributes scope.
-
- # You can define own errors for models or model attributes.
- # The values :model, :attribute and :value are always available for interpolation.
- #
- # For example,
- # models:
- # user:
- # blank: "This is a custom blank message for {{model}}: {{attribute}}"
- # attributes:
- # login:
- # blank: "This is a custom blank message for User login"
- # Will define custom blank validation message for User model and
- # custom blank validation message for login attribute of User model.
- #models:
-
- # Translate model names. Used in Model.human_name().
- #models:
- # For example,
- # user: "Dude"
- # will translate User model name to "Dude"
-
- # Translate model attribute names. Used in Model.human_attribute_name(attribute).
- #attributes:
- # For example,
- # user:
- # login: "Handle"
- # will translate User attribute "login" as "Handle"
-
+++ /dev/null
-en:
- date:
- formats:
- # Use the strftime parameters for formats.
- # When no format has been given, it uses default.
- # You can provide other formats here if you like!
- default: "%Y-%m-%d"
- short: "%b %d"
- long: "%B %d, %Y"
-
- day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
- abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
-
- # Don't forget the nil at the beginning; there's no such thing as a 0th month
- month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
- abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
- # Used in date_select and datime_select.
- order: [ :year, :month, :day ]
-
- time:
- formats:
- default: "%a, %d %b %Y %H:%M:%S %z"
- short: "%d %b %H:%M"
- long: "%B %d, %Y %H:%M"
- am: "am"
- pm: "pm"
-
-# Used in array.to_sentence.
- support:
- array:
- words_connector: ", "
- two_words_connector: " and "
- last_word_connector: ", and "
+++ /dev/null
-curr_dir = File.expand_path(File.dirname(__FILE__))
-rails_locale_dir = File.expand_path(File.join(curr_dir, "..", "rails"))
-
-puts "Fetching latest Rails locale files to #{rails_locale_dir}"
-
-exec %(
- curl -Lo '#{rails_locale_dir}/action_view.yml' http://github.com/rails/rails/tree/master/actionpack/lib/action_view/locale/en.yml?raw=true
-
- curl -Lo '#{rails_locale_dir}/active_record.yml' http://github.com/rails/rails/tree/master/activerecord/lib/active_record/locale/en.yml?raw=true
-
- curl -Lo '#{rails_locale_dir}/active_support.yml' http://github.com/rails/rails/tree/master/activesupport/lib/active_support/locale/en.yml?raw=true
-)
+++ /dev/null
-$KCODE = 'u'
-
-require 'rubygems'
-require 'i18n'
-
-module I18n
- module Backend
- class Simple
- public :translations, :init_translations
- end
- end
-end
-
-class KeyStructure
- attr_reader :result
-
- def initialize(locale)
- @locale = locale.to_sym
- init_backend
-
- @reference = I18n.backend.translations[:'en']
- @data = I18n.backend.translations[@locale]
-
- @result = {:bogus => [], :missing => [], :pluralization => []}
- @key_stack = []
- end
-
- def run
- compare :missing, @reference, @data
- compare :bogus, @data, @reference
- end
-
- def output
- [:missing, :bogus, :pluralization].each do |direction|
- next unless result[direction].size > 0
- case direction
- when :pluralization
- puts "\nThe following pluralization keys seem to differ:"
- else
- puts "\nThe following keys seem to be #{direction} for #{@locale.inspect}:"
- end
- puts ' ' + result[direction].join("\n ")
- end
- if result.map{|k, v| v.size == 0}.uniq == [true]
- puts "No inconsistencies found."
- end
- puts "\n"
- end
-
- protected
-
- def compare(direction, reference, data)
- reference.each do |key, value|
- if data.has_key?(key)
- @key_stack << key
- if namespace?(value)
- compare direction, value, (namespace?(data[key]) ? data[key] : {})
- elsif pluralization?(value)
- compare :pluralization, value, (pluralization?(data[key]) ? data[key] : {})
- end
- @key_stack.pop
- else
- @result[direction] << current_key(key)
- end
- end
- end
-
- def current_key(key)
- (@key_stack.dup << key).join('.')
- end
-
- def namespace?(hash)
- Hash === hash and !pluralization?(hash)
- end
-
- def pluralization?(hash)
- Hash === hash and hash.has_key?(:one) and hash.has_key?(:other)
- end
-
- def init_backend
- I18n.load_path = %W(
- rails/action_view.yml
- rails/active_record.yml
- rails/active_support.yml
- )
- I18n.load_path += Dir["locale/#{@locale}.{rb,yml}"]
- I18n.backend.init_translations
- end
-end
+++ /dev/null
-require File.dirname(__FILE__) + '/lib/key_structure.rb'
-
-locale = ARGV.first || raise("must give a locale as a command line argument")
-
-test = KeyStructure.new locale
-test.run
-test.output
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>nop</string>
- <key>command</key>
- <string>#!/usr/bin/ruby
-require 'rubygems'
-require 'i18n'
-I18n.locale = :en
-I18n.load_path << File.join(ENV['TM_PROJECT_DIRECTORY'], 'config', 'locales', 'en.yml')
-
-class << Object
- def const_missing(const)
- nil
- end
-end
-
-def method_missing(method, *args)
- "**#{method}**"
-end
-
-def t(*args)
- I18n.t(*args)
-end
-
-def args_to_array(*args)
- args
-end
-
-args = eval('args_to_array(' + ENV['TM_SELECTED_TEXT'] + ')')
-
-if args.last.is_a?(Hash)
- args.last.each { |k, v| args.last[k] = "**#{k}**" if v.nil? }
-end
-
-print I18n.t(*args)
-</string>
- <key>fallbackInput</key>
- <string>none</string>
- <key>input</key>
- <string>selection</string>
- <key>keyEquivalent</key>
- <string>@I</string>
- <key>name</key>
- <string>Lookup Translation</string>
- <key>output</key>
- <string>showAsTooltip</string>
- <key>uuid</key>
- <string>7DAF30C3-0247-4E94-AA44-DD2E69A6E236</string>
-</dict>
-</plist>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>beforeRunningCommand</key>
- <string>nop</string>
- <key>command</key>
- <string>#!/usr/bin/ruby
-
-require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
-require ENV['TM_BUNDLE_SUPPORT'] + '/lib/rails_i18n.rb'
-
-class Hash
- def deep_merge(other)
- # deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809
- merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
- merge(other, &merger)
- end
-
- def set(keys, value)
- key = keys.shift
- if keys.empty?
- self[key] = value
- else
- self[key] ||= {}
- self[key].set keys, value
- end
- end
-end
-
-project_dir = ENV['TM_PROJECT_DIRECTORY']
-path = File.join(project_dir, 'log', 'translations')
-
-translation = ENV['TM_SELECTED_TEXT'].gsub(/^\s*("|')|("|')\s*$/, '')
-key = TextMate::UI.request_string :title => 'Key', :prompt => 'Key'
-keys = ['en'] + key.split('.')
-
-log_file = File.open(path, 'a+')
-log_file.puts "#{key}: #{translation}"
-
-data = { 'en' => {} }
-data.set keys, translation
-
-path = File.join(project_dir, 'log', 'translations.yml')
-data = data.deep_merge YAML.load(File.open(path, 'r') { |f| f.read }) if File.exists?(path)
-
-File.open(path, 'w+') { |f| f.write YAML.dump(data) }
-
-print "t(:'#{key}')"
-</string>
- <key>fallbackInput</key>
- <string>none</string>
- <key>input</key>
- <string>selection</string>
- <key>keyEquivalent</key>
- <string>@E</string>
- <key>name</key>
- <string>extract translation</string>
- <key>output</key>
- <string>replaceSelectedText</string>
- <key>uuid</key>
- <string>914BB49A-6809-425F-812E-7C3C5321D403</string>
-</dict>
-</plist>
+++ /dev/null
-# = Dictionary
-#
-# The Dictionary class is a Hash that preserves order.
-# So it has some array-like extensions also. By defualt
-# a Dictionary object preserves insertion order, but any
-# order can be specified including alphabetical key order.
-#
-# == Usage
-#
-# Just require this file and use Dictionary instead of Hash.
-#
-# # You can do simply
-# hsh = Dictionary.new
-# hsh['z'] = 1
-# hsh['a'] = 2
-# hsh['c'] = 3
-# p hsh.keys #=> ['z','a','c']
-#
-# # or using Dictionary[] method
-# hsh = Dictionary['z', 1, 'a', 2, 'c', 3]
-# p hsh.keys #=> ['z','a','c']
-#
-# # but this don't preserve order
-# hsh = Dictionary['z'=>1, 'a'=>2, 'c'=>3]
-# p hsh.keys #=> ['a','c','z']
-#
-# # Dictionary has useful extensions: push, pop and unshift
-# p hsh.push('to_end', 15) #=> true, key added
-# p hsh.push('to_end', 30) #=> false, already - nothing happen
-# p hsh.unshift('to_begin', 50) #=> true, key added
-# p hsh.unshift('to_begin', 60) #=> false, already - nothing happen
-# p hsh.keys #=> ["to_begin", "a", "c", "z", "to_end"]
-# p hsh.pop #=> ["to_end", 15], if nothing remains, return nil
-# p hsh.keys #=> ["to_begin", "a", "c", "z"]
-# p hsh.shift #=> ["to_begin", 30], if nothing remains, return nil
-#
-# == Usage Notes
-#
-# * You can use #order_by to set internal sort order.
-# * #<< takes a two element [k,v] array and inserts.
-# * Use ::auto which creates Dictionay sub-entries as needed.
-# * And ::alpha which creates a new Dictionary sorted by key.
-#
-# == Authors
-#
-# * Jan Molic
-# * Thomas Sawyer
-#
-# == Acknowledgments
-#
-# * Andrew Johnson (merge, to_a, inspect, shift and Hash[])
-# * Jeff Sharpe (reverse and reverse!)
-# * Thomas Leitner (has_key? and key?)
-#
-# Originally ported from OrderHash 2.0, Copyright (c) 2005 jan molic
-#
-# == History
-#
-# * 2007.10.31 trans
-# ** Fixed initialize so the constructor blocks correctly effected dictionary rather then just the internal hash.
-#
-# == Copying
-#
-# Copyright (c) 2005 Jan Molic, Thomas Sawyer
-#
-# Ruby License
-#
-# This module is free software. You may use, modify, and/or redistribute this
-# software under the same terms as Ruby.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.
-
-
-# = Dictionary
-#
-# The Dictionary class is a Hash that preserves order.
-# So it has some array-like extensions also. By defualt
-# a Dictionary object preserves insertion order, but any
-# order can be specified including alphabetical key order.
-#
-# == Usage
-#
-# Just require this file and use Dictionary instead of Hash.
-#
-# # You can do simply
-# hsh = Dictionary.new
-# hsh['z'] = 1
-# hsh['a'] = 2
-# hsh['c'] = 3
-# p hsh.keys #=> ['z','a','c']
-#
-# # or using Dictionary[] method
-# hsh = Dictionary['z', 1, 'a', 2, 'c', 3]
-# p hsh.keys #=> ['z','a','c']
-#
-# # but this don't preserve order
-# hsh = Dictionary['z'=>1, 'a'=>2, 'c'=>3]
-# p hsh.keys #=> ['a','c','z']
-#
-# # Dictionary has useful extensions: push, pop and unshift
-# p hsh.push('to_end', 15) #=> true, key added
-# p hsh.push('to_end', 30) #=> false, already - nothing happen
-# p hsh.unshift('to_begin', 50) #=> true, key added
-# p hsh.unshift('to_begin', 60) #=> false, already - nothing happen
-# p hsh.keys #=> ["to_begin", "a", "c", "z", "to_end"]
-# p hsh.pop #=> ["to_end", 15], if nothing remains, return nil
-# p hsh.keys #=> ["to_begin", "a", "c", "z"]
-# p hsh.shift #=> ["to_begin", 30], if nothing remains, return nil
-#
-# == Usage Notes
-#
-# * You can use #order_by to set internal sort order.
-# * #<< takes a two element [k,v] array and inserts.
-# * Use ::auto which creates Dictionay sub-entries as needed.
-# * And ::alpha which creates a new Dictionary sorted by key.
-#
-class Dictionary
-
- include Enumerable
-
- class << self
- #--
- # TODO is this needed? Doesn't the super class do this?
- #++
-
- def [](*args)
- hsh = new
- if Hash === args[0]
- hsh.replace(args[0])
- elsif (args.size % 2) != 0
- raise ArgumentError, "odd number of elements for Hash"
- else
- while !args.empty?
- hsh[args.shift] = args.shift
- end
- end
- hsh
- end
-
- # Like #new but the block sets the order.
- #
- def new_by(*args, &blk)
- new(*args).order_by(&blk)
- end
-
- # Alternate to #new which creates a dictionary sorted by key.
- #
- # d = Dictionary.alpha
- # d["z"] = 1
- # d["y"] = 2
- # d["x"] = 3
- # d #=> {"x"=>3,"y"=>2,"z"=>2}
- #
- # This is equivalent to:
- #
- # Dictionary.new.order_by { |key,value| key }
-
- def alpha(*args, &block)
- new(*args, &block).order_by_key
- end
-
- # Alternate to #new which auto-creates sub-dictionaries as needed.
- #
- # d = Dictionary.auto
- # d["a"]["b"]["c"] = "abc" #=> { "a"=>{"b"=>{"c"=>"abc"}}}
- #
- def auto(*args)
- #AutoDictionary.new(*args)
- leet = lambda { |hsh, key| hsh[key] = new(&leet) }
- new(*args, &leet)
- end
- end
-
- # New Dictiionary.
-
- def initialize(*args, &blk)
- @order = []
- @order_by = nil
- if blk
- dict = self # This ensure autmatic key entry effect the
- oblk = lambda{ |hsh, key| blk[dict,key] } # dictionary rather then just the interal hash.
- @hash = Hash.new(*args, &oblk)
- else
- @hash = Hash.new(*args)
- end
- end
-
- def order
- reorder if @order_by
- @order
- end
-
- # Keep dictionary sorted by a specific sort order.
-
- def order_by( &block )
- @order_by = block
- order
- self
- end
-
- # Keep dictionary sorted by key.
- #
- # d = Dictionary.new.order_by_key
- # d["z"] = 1
- # d["y"] = 2
- # d["x"] = 3
- # d #=> {"x"=>3,"y"=>2,"z"=>2}
- #
- # This is equivalent to:
- #
- # Dictionary.new.order_by { |key,value| key }
- #
- # The initializer Dictionary#alpha also provides this.
-
- def order_by_key
- @order_by = lambda { |k,v| k }
- order
- self
- end
-
- # Keep dictionary sorted by value.
- #
- # d = Dictionary.new.order_by_value
- # d["z"] = 1
- # d["y"] = 2
- # d["x"] = 3
- # d #=> {"x"=>3,"y"=>2,"z"=>2}
- #
- # This is equivalent to:
- #
- # Dictionary.new.order_by { |key,value| value }
-
- def order_by_value
- @order_by = lambda { |k,v| v }
- order
- self
- end
-
- #
-
- def reorder
- if @order_by
- assoc = @order.collect{ |k| [k,@hash[k]] }.sort_by(&@order_by)
- @order = assoc.collect{ |k,v| k }
- end
- @order
- end
-
- #def ==( hsh2 )
- # return false if @order != hsh2.order
- # super hsh2
- #end
-
- def ==(hsh2)
- if hsh2.is_a?( Dictionary )
- @order == hsh2.order &&
- @hash == hsh2.instance_variable_get("@hash")
- else
- false
- end
- end
-
- def [] k
- @hash[ k ]
- end
-
- def fetch(k, *a, &b)
- @hash.fetch(k, *a, &b)
- end
-
- # Store operator.
- #
- # h[key] = value
- #
- # Or with additional index.
- #
- # h[key,index] = value
-
- def []=(k, i=nil, v=nil)
- if v
- insert(i,k,v)
- else
- store(k,i)
- end
- end
-
- def insert( i,k,v )
- @order.insert( i,k )
- @hash.store( k,v )
- end
-
- def store( a,b )
- @order.push( a ) unless @hash.has_key?( a )
- @hash.store( a,b )
- end
-
- def clear
- @order = []
- @hash.clear
- end
-
- def delete( key )
- @order.delete( key )
- @hash.delete( key )
- end
-
- def each_key
- order.each { |k| yield( k ) }
- self
- end
-
- def each_value
- order.each { |k| yield( @hash[k] ) }
- self
- end
-
- def each
- order.each { |k| yield( k,@hash[k] ) }
- self
- end
- alias each_pair each
-
- def delete_if
- order.clone.each { |k| delete k if yield(k,@hash[k]) }
- self
- end
-
- def values
- ary = []
- order.each { |k| ary.push @hash[k] }
- ary
- end
-
- def keys
- order
- end
-
- def invert
- hsh2 = self.class.new
- order.each { |k| hsh2[@hash[k]] = k }
- hsh2
- end
-
- def reject(&block)
- self.dup.delete_if(&block)
- end
-
- def reject!( &block )
- hsh2 = reject(&block)
- self == hsh2 ? nil : hsh2
- end
-
- def replace( hsh2 )
- @order = hsh2.order
- @hash = hsh2.hash
- end
-
- def shift
- key = order.first
- key ? [key,delete(key)] : super
- end
-
- def unshift( k,v )
- unless @hash.include?( k )
- @order.unshift( k )
- @hash.store( k,v )
- true
- else
- false
- end
- end
-
- def <<(kv)
- push(*kv)
- end
-
- def push( k,v )
- unless @hash.include?( k )
- @order.push( k )
- @hash.store( k,v )
- true
- else
- false
- end
- end
-
- def pop
- key = order.last
- key ? [key,delete(key)] : nil
- end
-
- def inspect
- ary = []
- each {|k,v| ary << k.inspect + "=>" + v.inspect}
- '{' + ary.join(", ") + '}'
- end
-
- def dup
- a = []
- each{ |k,v| a << k; a << v }
- self.class[*a]
- end
-
- def update( hsh2 )
- hsh2.each { |k,v| self[k] = v }
- reorder
- self
- end
- alias :merge! update
-
- def merge( hsh2 )
- self.dup.update(hsh2)
- end
-
- def select
- ary = []
- each { |k,v| ary << [k,v] if yield k,v }
- ary
- end
-
- def reverse!
- @order.reverse!
- self
- end
-
- def reverse
- dup.reverse!
- end
-
- #
- def first(x=nil)
- return @hash[order.first] unless x
- order.first(x).collect { |k| @hash[k] }
- end
-
- #
- def last(x=nil)
- return @hash[order.last] unless x
- order.last(x).collect { |k| @hash[k] }
- end
-
- def length
- @order.length
- end
- alias :size :length
-
- def empty?
- @hash.empty?
- end
-
- def has_key?(key)
- @hash.has_key?(key)
- end
-
- def key?(key)
- @hash.key?(key)
- end
-
- def to_a
- ary = []
- each { |k,v| ary << [k,v] }
- ary
- end
-
- def to_s
- self.to_a.to_s
- end
-
- def to_hash
- @hash.dup
- end
-
- def to_h
- @hash.dup
- end
-end
\ No newline at end of file
+++ /dev/null
-require File.join(File.dirname(__FILE__), 'dictionary')
-require File.join(File.dirname(__FILE__), 'yaml_waml')
\ No newline at end of file
+++ /dev/null
-# stolen from Kakutani Shintaro http://github.com/kakutani/yaml_waml
-
-require "yaml"
-
-class String
- def is_binary_data?
- false
- end
-end
-
-module YamlWaml
- def decode(orig_yamled)
- yamled_str = case orig_yamled
- when String then orig_yamled
- when StringIO then orig_yamled.string
- else return orig_yamled
- end
- yamled_str.gsub!(/\\x(\w{2})/){[$1].pack("H2")}
- return yamled_str
- end
- module_function :decode
-end
-
-ObjectSpace.each_object(Class) do |klass|
- klass.class_eval do
- if method_defined?(:to_yaml) && !method_defined?(:to_yaml_with_decode)
- def to_yaml_with_decode(*args)
- io = args.shift if IO === args.first
- yamled_str = YamlWaml.decode(to_yaml_without_decode(*args))
- io.write(yamled_str) if io
- return yamled_str
- end
- alias_method :to_yaml_without_decode, :to_yaml
- alias_method :to_yaml, :to_yaml_with_decode
- end
- end
-end
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>name</key>
- <string>Rails I18n</string>
- <key>ordering</key>
- <array>
- <string>914BB49A-6809-425F-812E-7C3C5321D403</string>
- <string>7DAF30C3-0247-4E94-AA44-DD2E69A6E236</string>
- </array>
- <key>uuid</key>
- <string>F217218F-CCD3-45C0-8D67-DB761EA9CE61</string>
-</dict>
-</plist>