Class: ApiMaker::Configuration
- Inherits:
-
Object
- Object
- ApiMaker::Configuration
- Defined in:
- lib/api_maker/configuration.rb
Instance Attribute Summary collapse
-
#ability_class_name ⇒ Object
Returns the value of attribute ability_class_name.
-
#before_create_event_callbacks ⇒ Object
Returns the value of attribute before_create_event_callbacks.
-
#devise_sign_in_enabled ⇒ Object
Returns the value of attribute devise_sign_in_enabled.
-
#devise_sign_out_enabled ⇒ Object
Returns the value of attribute devise_sign_out_enabled.
-
#on_thread_callbacks ⇒ Object
Returns the value of attribute on_thread_callbacks.
-
#profiling ⇒ Object
Returns the value of attribute profiling.
-
#react_native_path ⇒ Object
Returns the value of attribute react_native_path.
-
#threadding ⇒ Object
Returns the value of attribute threadding.
Class Method Summary collapse
- .configure {|ApiMaker::Configuration.current| ... } ⇒ Object
- .current ⇒ Object
- .profile(name_block, &blk) ⇒ Object
Instance Method Summary collapse
- #ability_class ⇒ Object
- #before_create_event(&blk) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #on_error(&blk) ⇒ Object
- #on_thread(&blk) ⇒ Object
- #report_error(error) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
29 30 31 32 33 34 35 36 37 |
# File 'lib/api_maker/configuration.rb', line 29 def initialize self.ability_class_name = "ApiMaker::Ability" self.before_create_event_callbacks = [] self.devise_sign_in_enabled = true self.devise_sign_out_enabled = true self.threadding = true @on_error = [] end |
Instance Attribute Details
#ability_class_name ⇒ Object
Returns the value of attribute ability_class_name.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def ability_class_name @ability_class_name end |
#before_create_event_callbacks ⇒ Object
Returns the value of attribute before_create_event_callbacks.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def before_create_event_callbacks @before_create_event_callbacks end |
#devise_sign_in_enabled ⇒ Object
Returns the value of attribute devise_sign_in_enabled.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def devise_sign_in_enabled @devise_sign_in_enabled end |
#devise_sign_out_enabled ⇒ Object
Returns the value of attribute devise_sign_out_enabled.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def devise_sign_out_enabled @devise_sign_out_enabled end |
#on_thread_callbacks ⇒ Object
Returns the value of attribute on_thread_callbacks.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def on_thread_callbacks @on_thread_callbacks end |
#profiling ⇒ Object
Returns the value of attribute profiling.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def profiling @profiling end |
#react_native_path ⇒ Object
Returns the value of attribute react_native_path.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def react_native_path @react_native_path end |
#threadding ⇒ Object
Returns the value of attribute threadding.
2 3 4 |
# File 'lib/api_maker/configuration.rb', line 2 def threadding @threadding end |
Class Method Details
.configure {|ApiMaker::Configuration.current| ... } ⇒ Object
17 18 19 |
# File 'lib/api_maker/configuration.rb', line 17 def self.configure yield ApiMaker::Configuration.current end |
.current ⇒ Object
13 14 15 |
# File 'lib/api_maker/configuration.rb', line 13 def self.current @current ||= ApiMaker::Configuration.new end |
.profile(name_block, &blk) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/api_maker/configuration.rb', line 21 def self.profile(name_block, &blk) if ApiMaker::Configuration.current.profiling Rack::MiniProfiler.step("AM #{name_block.call}", &blk) else yield end end |
Instance Method Details
#ability_class ⇒ Object
39 40 41 |
# File 'lib/api_maker/configuration.rb', line 39 def ability_class ability_class_name.constantize end |
#before_create_event(&blk) ⇒ Object
43 44 45 |
# File 'lib/api_maker/configuration.rb', line 43 def before_create_event(&blk) before_create_event_callbacks << blk end |
#on_error(&blk) ⇒ Object
47 48 49 |
# File 'lib/api_maker/configuration.rb', line 47 def on_error(&blk) @on_error << blk end |
#on_thread(&blk) ⇒ Object
51 52 53 54 |
# File 'lib/api_maker/configuration.rb', line 51 def on_thread(&blk) @on_thread_callbacks ||= [] @on_thread_callbacks << blk end |
#report_error(error) ⇒ Object
56 57 58 59 60 |
# File 'lib/api_maker/configuration.rb', line 56 def report_error(error) @on_error.each do |on_error| on_error.call(error) end end |