module WargamingApi::Concern::Attributable

Public Class Methods

included(base) click to toggle source
# File lib/wargaming_api/concern/attributable.rb, line 2
def self.included(base)
  base.extend ClassMethods
  base.class_eval do
    cattr_accessor :_attributes
    self._attributes = {}
  end
end

Public Instance Methods

apply_type(name, value) click to toggle source
# File lib/wargaming_api/concern/attributable.rb, line 16
def apply_type(name, value)
  return value if value.nil?

  case self._attributes[name.to_sym]
  when :datetime
    Time.at(value)
  else
    value
  end
end