class Uber::Base

Attributes

attrs[R]
to_h[R]

Public Class Methods

new(attrs = {}) click to toggle source

Initializes a new object

@param attrs [Hash] @return [Uber::Base]

# File lib/uber/base.rb, line 11
def initialize(attrs = {})
  return if attrs.nil? || attrs.empty?
  attrs.each do |key, value|
    if respond_to?(:"#{key}=")
      send(:"#{key}=", value)
    end
  end
end

Public Instance Methods

[](method) click to toggle source

Fetches an attribute of an object using hash notation

@param method [String, Symbol] Message to send to the object

# File lib/uber/base.rb, line 23
def [](method)
  send(method.to_sym)
rescue NoMethodError
  nil
end