lib/client_success/resources/base.rb
def declare_read_only_attrs(attrs)
          @attributes = (@attributes || {}).merge(attrs)
          attrs.each_pair do |attr_name, _value_type|
            define_read_method(attr_name)
            define_write_error_method(attr_name)
          end
        end
# Allows subclass resources to define available read-only
# attributes (e.g., 'id'), so that there is a corresponding
# getter method available, and the setter method will raise
# an error.
#
# @param [Hash] attrs
#
# @example
#   class Foo < Base
#     declare_read_only_attrs(id: :int)
#     ...
#   end
#
Allows subclass resources to define available read-only
attributes , so that there is a corresponding
getter method available, and the setter method will raise
an error.
Allows subclass resources to define available read - only attributes so that there is a corresponding getter method available and the setter method will raise an error .
def declare_read_only_attrs(attrs)
          @attributes = (@attributes || {}).merge(attrs)
          attrs.each_pair do |attr_name, _value_type|
            define_read_method(attr_name)
            define_write_error_method(attr_name)
          end
        end
def declare_read_only_attrs ( attrs ) @attributes = ( @attributes || { } ) . merge ( attrs ) attrs . each_pair do | attr_name , _value_type | define_read_method ( attr_name ) define_write_error_method ( attr_name ) end end
Allows subclass resources to define available read-only
attributes (e.g., 'id'), so that there is a corresponding
getter method available, and the setter method will raise
an error.
Allows subclass resources to define available read - only attributes ( e . g . ' id ' ) so that there is a corresponding getter method available and the setter method will raise an error .
attrs
None
example
class Foo < Base declare_read_only_attrs(id: :int) ... end
class Foo < Base declare_read_only_attrs ( id : : int ) ... end