Class: ApiMaker::Configuration
- Inherits:
-
Object
- Object
- ApiMaker::Configuration
- Defined in:
- lib/api_maker/configuration.rb
Instance Attribute Summary collapse
-
#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, &blk) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #on_error(&blk) ⇒ Object
- #report_error(error) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 |
# File 'lib/api_maker/configuration.rb', line 20 def initialize @on_error = [] @threadding = true end |
Instance Attribute Details
#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
8 9 10 |
# File 'lib/api_maker/configuration.rb', line 8 def self.configure yield ApiMaker::Configuration.current end |
.current ⇒ Object
4 5 6 |
# File 'lib/api_maker/configuration.rb', line 4 def self.current @current ||= ApiMaker::Configuration.new end |
.profile(name, &blk) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/api_maker/configuration.rb', line 12 def self.profile(name, &blk) if ApiMaker::Configuration.current.profiling Rack::MiniProfiler.step("AM #{name}", &blk) else yield end end |
Instance Method Details
#on_error(&blk) ⇒ Object
25 26 27 |
# File 'lib/api_maker/configuration.rb', line 25 def on_error(&blk) @on_error << blk end |
#report_error(error) ⇒ Object
29 30 31 32 33 |
# File 'lib/api_maker/configuration.rb', line 29 def report_error(error) @on_error.each do |on_error| on_error.call(error) end end |