Class: Stall::Config

Inherits:
Object
  • Object
show all
Extended by:
Utils::ConfigDSL
Defined in:
lib/stall/config.rb

Instance Method Summary collapse

Methods included from Utils::ConfigDSL

param

Instance Method Details

#default_app_domainObject



78
79
80
# File 'lib/stall/config.rb', line 78

def default_app_domain
  @default_app_domain || ENV['APP_DOMAIN']
end

#default_currency_as_moneyObject Also known as: default_currency



105
106
107
# File 'lib/stall/config.rb', line 105

def default_currency_as_money
  raw_default_currency && Money::Currency.new(raw_default_currency)
end

#default_user_modelObject



101
102
103
# File 'lib/stall/config.rb', line 101

def default_user_model
  default_user_model_name.try(:constantize)
end

#paymentObject



66
67
68
# File 'lib/stall/config.rb', line 66

def payment
  @payment ||= Stall::Payments::Config.new
end

#service_for(identifier) ⇒ Object

Fetch user config and add top-namespace lookup to avoid collision with Stall module services

Default allows looking up Stall namespace automatically, when no config has been given



87
88
89
90
91
92
93
94
95
# File 'lib/stall/config.rb', line 87

def service_for(identifier)
  class_name = if (service_name = services[identifier])
    "::#{ services[identifier].gsub(/^::/, '') }"
  else
    "Stall::#{ identifier.to_s.camelize }Service"
  end

  class_name.constantize
end

#services=(value) ⇒ Object



97
98
99
# File 'lib/stall/config.rb', line 97

def services=(value)
  self.services.merge!(value)
end

#shippingObject



62
63
64
# File 'lib/stall/config.rb', line 62

def shipping
  @shipping ||= Stall::Shipping::Config.new
end

#steps_initialization(value = nil, &block) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/stall/config.rb', line 70

def steps_initialization(value = nil, &block)
  if (value ||= block)
    @_steps_initialization_callback = value
  else
    @_steps_initialization_callback
  end
end