Sha256: b94d89420ef93c0ea91a4115ff2a4e4e8a7300113504f9bd2f18a8f4a6fd6c14

Contents?: true

Size: 406 Bytes

Versions: 27

Compression:

Stored size: 406 Bytes

Contents

# frozen_string_literal: false

if Lite::Ruby.configuration.monkey_patches.include?('struct')
  class Struct

    def [](key)
      send(key)
    end

    def []=(key, val)
      send("#{key}=", val)
    end

    def attributes
      each_pair.with_object({}) { |(key, val), hash| hash[key] = val }
    end

    def replace(args)
      args.each_pair { |key, val| send("#{key}=", val) }
    end

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
lite-ruby-1.1.9 lib/lite/ruby/struct.rb
lite-ruby-1.1.8 lib/lite/ruby/struct.rb
lite-ruby-1.1.7 lib/lite/ruby/struct.rb
lite-ruby-1.1.6 lib/lite/ruby/struct.rb
lite-ruby-1.1.5 lib/lite/ruby/struct.rb
lite-ruby-1.1.4 lib/lite/ruby/struct.rb
lite-ruby-1.1.3 lib/lite/ruby/struct.rb
lite-ruby-1.1.2 lib/lite/ruby/struct.rb
lite-ruby-1.1.1 lib/lite/ruby/struct.rb
lite-ruby-1.1.0 lib/lite/ruby/struct.rb
lite-ruby-1.0.31 lib/lite/ruby/struct.rb
lite-ruby-1.0.30 lib/lite/ruby/struct.rb
lite-ruby-1.0.29 lib/lite/ruby/struct.rb
lite-ruby-1.0.28 lib/lite/ruby/struct.rb
lite-ruby-1.0.27 lib/lite/ruby/struct.rb
lite-ruby-1.0.26 lib/lite/ruby/struct.rb
lite-ruby-1.0.25 lib/lite/ruby/struct.rb
lite-ruby-1.0.24 lib/lite/ruby/struct.rb
lite-ruby-1.0.23 lib/lite/ruby/struct.rb
lite-ruby-1.0.22 lib/lite/ruby/struct.rb