Class: ApiMaker::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/api_maker/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#profilingObject

Returns the value of attribute profiling.



2
3
4
# File 'lib/api_maker/configuration.rb', line 2

def profiling
  @profiling
end

#react_native_pathObject

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

#threaddingObject

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

.currentObject



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