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.2.7 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.6 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.5 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.4 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.3 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.2 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.1 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.2.0 lib/ruby_app/mixins/hash_mixin.rb