Class: WeixinRailsMiddleware::Configuration
- Inherits:
-
Object
- Object
- WeixinRailsMiddleware::Configuration
- Defined in:
- lib/weixin_rails_middleware/configuration.rb
Instance Attribute Summary collapse
-
#engine_path ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,.
-
#token_column ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,.
-
#token_model ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,.
-
#token_string ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #token_model_class ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 |
# File 'lib/weixin_rails_middleware/configuration.rb', line 7 def initialize @engine_path = DEFAULT_ENGINE_PATH @token_column = DEFAULT_TOKEN_COLUMN_NAME end |
Instance Attribute Details
#engine_path ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,
5 6 7 |
# File 'lib/weixin_rails_middleware/configuration.rb', line 5 def engine_path @engine_path end |
#token_column ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,
5 6 7 |
# File 'lib/weixin_rails_middleware/configuration.rb', line 5 def token_column @token_column end |
#token_model ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,
5 6 7 |
# File 'lib/weixin_rails_middleware/configuration.rb', line 5 def token_model @token_model end |
#token_string ⇒ Object
use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,
5 6 7 |
# File 'lib/weixin_rails_middleware/configuration.rb', line 5 def token_string @token_string end |
Instance Method Details
#token_model_class ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/weixin_rails_middleware/configuration.rb', line 12 def token_model_class raise "You need to config `token_model` in config/initializers/weixin_rails_middleware.rb" if token_model.blank? token_model_c = token_model.constantize unless token_model_c.table_exists? raise "You don't have #{token_model_c.table_name} table" end token_model_c end |