module Giteaucrat::Common

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/giteaucrat/common.rb, line 13
def initialize(attributes = {})
  assign_attributes(attributes)
end

Public Instance Methods

assign_attributes(attributes) click to toggle source

@param [Hash] attributes

# File lib/giteaucrat/common.rb, line 18
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