Sha256: e95c526ba6c89704928ba35dfcb30deca505b306d3bf6afde02345b1aa15b1d6

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

# coding: utf-8
# frozen_string_literal: true

############################################
# © Alex Semyonov, 2013—2017, MIT License  #
# Author: Alex Semyonov <alex@semyonov.us> #
############################################

require 'giteaucrat'

module Giteaucrat
  module Common
    def initialize(attributes = {})
      assign_attributes(attributes)
    end

    # @param [Hash] attributes
    def assign_attributes(attributes)
      attributes.each do |name, value|
        writer = "#{name}="
        value = value.force_encoding('utf-8') if value.respond_to?(:force_encoding)
        if respond_to?(writer)
          public_send(writer, value)
        else
          STDERR.puts("Unknown method #{self.class}##{writer}")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
giteaucrat-0.1.0 lib/giteaucrat/common.rb
giteaucrat-0.0.8 lib/giteaucrat/common.rb