Sha256: d51e5ada74968cb5919819edceab9ed47467106b39faaaf781dc5109502d06ee

Contents?: true

Size: 548 Bytes

Versions: 28

Compression:

Stored size: 548 Bytes

Contents

module RubyApp

  module Mixins

    module HashMixin

      def method_missing(name, *arguments)
        if name.to_s.match(/(.*)=/)
          capture = $~.captures[0]
          self[capture.to_sym] = arguments[0]
        else
          return self[name.to_sym]
        end
      end

    end

  end

end

class Hash
  include RubyApp::Mixins::HashMixin

  def symbolize!
    copy=self.dup
    self.clear
    copy.each do |name, value|
      value.symbolize! if value.is_a?(Hash)
      self[name.to_sym] = value
    end
    return self
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
RubyApp-0.5.34 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.33 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.32 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.31 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.30 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.29 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.28 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.23 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.18 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.17 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.16 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.15 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.14 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.13 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.12 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.11 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.10 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.9 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.5.0 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.8 lib/ruby_app/mixins/hash_mixin.rb