Sha256: 1c6d89ae11af65925afb14b8fbda7fe6e97f885c0673cf0e162d6f82b55a4c89
Contents?: true
Size: 786 Bytes
Versions: 26
Compression:
Stored size: 786 Bytes
Contents
require 'active_support/core_ext/string/inflections' module Lol class Model # @!attribute [r] raw # @return [Hash] raw version of options Hash used to initialize Model attr_reader :raw # Initializes a Lol::Model # @param options [Hash] # @return [Lol::Model] def initialize options = {} @raw = options options.each do |attribute_name, value| send "#{attribute_name.to_s.underscore}=", value end end # Re-written Object#inspect to skip the @raw instance variable # @return [String] representation of object def inspect vars = self.instance_variables. select {|v| v != :@raw}. map{|v| "#{v}=#{instance_variable_get(v).inspect}"}.join(", ") "<#{self.class}: #{vars}>" end end end
Version data entries
26 entries across 26 versions & 1 rubygems