Sha256: 7c2150a89f61e2faaede0b71c5b8dcfd78a83b2071eea74f6743debabbde1b60
Contents?: true
Size: 714 Bytes
Versions: 7
Compression:
Stored size: 714 Bytes
Contents
# frozen_string_literal: true # (c) Copyright 2021 Ribose Inc. # module Glossarist class Model def self.new(params = {}) return params if params.is_a?(self) super end def initialize(attributes = {}) attributes.each_pair { |k, v| set_attribute(k, v) } end def set_attribute(name, value) public_send("#{name}=", value) rescue NoMethodError if Config.extension_attributes.include?(name) extension_attributes[name] = value else raise ArgumentError, "#{self.class.name} does not have " + "attribute #{name} defined or the attribute is read only." end end def self.from_h(hash) new(hash) end end end
Version data entries
7 entries across 7 versions & 2 rubygems