Sha256: 2d37b8274b65bcd1fedd6d3c1cdd769e0a49036eb4c147652ea8db130e51702f

Contents?: true

Size: 759 Bytes

Versions: 5

Compression:

Stored size: 759 Bytes

Contents

# coding: utf-8

################################################
# © Alexander Semyonov, 2013—2013, MIT License #
# Author: Alexander Semyonov <al@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

5 entries across 5 versions & 1 rubygems

Version Path
giteaucrat-0.0.7 lib/giteaucrat/common.rb
giteaucrat-0.0.6 lib/giteaucrat/common.rb
giteaucrat-0.0.5 lib/giteaucrat/common.rb
giteaucrat-0.0.4 lib/giteaucrat/common.rb
giteaucrat-0.0.3 lib/giteaucrat/common.rb