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.0.21 lib/lite/ruby/struct.rb
lite-ruby-1.0.20 lib/lite/ruby/struct.rb
lite-ruby-1.0.19 lib/lite/ruby/struct.rb
lite-ruby-1.0.18 lib/lite/ruby/struct.rb
lite-ruby-1.0.17 lib/lite/ruby/struct.rb
lite-ruby-1.0.16 lib/lite/ruby/struct.rb
lite-ruby-1.0.15 lib/lite/ruby/struct.rb