Sha256: 157382fb89cdf60d72abca5ca0134527345a03792eaf0fe6c8a43b3d755e2c58

Contents?: true

Size: 622 Bytes

Versions: 125

Compression:

Stored size: 622 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 prepend!(key, value)
    self[key] = "#{value} #{self[key]}"
  end

  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

125 entries across 125 versions & 1 rubygems

Version Path
RubyApp-0.7.16 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.15 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.14 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.13 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.12 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.11 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.10 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.9 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.5 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.4 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.3 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.2 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.1 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.7.0 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.6.71 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.6.70 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.6.69 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.6.68 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.6.67 lib/ruby_app/mixins/hash_mixin.rb
RubyApp-0.6.66 lib/ruby_app/mixins/hash_mixin.rb