Module: Ghtk

Defined in:
lib/ghtk.rb,
lib/ghtk/error.rb,
lib/ghtk/order.rb,
lib/ghtk/config.rb,
lib/ghtk/request.rb,
lib/ghtk/version.rb,
lib/ghtk/shipping_fee.rb,
lib/ghtk/flexible_params.rb

Defined Under Namespace

Modules: Validations Classes: BadParamsError, Config, CreateOrderError, Error, FlexibleParams, ForbiddenError, Order, OrderIdExistError, Request, RequestError, ServerError, ShippingFee

Constant Summary collapse

VERSION =
"1.0.5"

Class Method Summary collapse

Class Method Details

.is_blank?(object) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ghtk.rb', line 20

def self.is_blank?(object)
  case object
  when NilClass, FalseClass
    return true
  when TrueClass, Numeric, Fixnum
    return false
  when Array, Hash
    return object.empty?
  when String
    return object.empty? || !object.match(/\A[[:space:]]*\z/).nil?
  else
    return object.respond_to?(:empty?) ? !!object.empty? : !object
  end
end

.setup {|@config| ... } ⇒ Object

Yields:

  • (@config)


14
15
16
17
18
# File 'lib/ghtk.rb', line 14

def self.setup
  @config ||= Ghtk::Config.new
  yield @config if block_given?
  @config
end