Class: RSpecDocumentation::Configuration
- Inherits:
-
Object
- Object
- RSpecDocumentation::Configuration
- Defined in:
- lib/rspec_documentation/configuration.rb
Overview
Configures the rspec-documentation gem, allows setting a context that makes values available to each example.
Instance Attribute Summary collapse
-
#consistent_height ⇒ Object
Returns the value of attribute consistent_height.
-
#fail_fast ⇒ Object
Returns the value of attribute fail_fast.
-
#full_backtrace ⇒ Object
Returns the value of attribute full_backtrace.
-
#hooks ⇒ Object
readonly
Returns the value of attribute hooks.
-
#index_search ⇒ Object
Returns the value of attribute index_search.
-
#max_height ⇒ Object
Returns the value of attribute max_height.
-
#table_of_contents ⇒ Object
Returns the value of attribute table_of_contents.
Instance Method Summary collapse
- #attribution ⇒ Object
- #context(&block) ⇒ Object
- #context_defined? ⇒ Boolean
- #hook(name, &block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rspec_documentation/configuration.rb', line 9 def initialize @context_defined = false @consistent_height = false @max_height = '30rem' @fail_fast = false @full_backtrace = false @table_of_contents = true @index_search = true @hooks = {} end |
Instance Attribute Details
#consistent_height ⇒ Object
Returns the value of attribute consistent_height.
7 8 9 |
# File 'lib/rspec_documentation/configuration.rb', line 7 def consistent_height @consistent_height end |
#fail_fast ⇒ Object
Returns the value of attribute fail_fast.
7 8 9 |
# File 'lib/rspec_documentation/configuration.rb', line 7 def fail_fast @fail_fast end |
#full_backtrace ⇒ Object
Returns the value of attribute full_backtrace.
7 8 9 |
# File 'lib/rspec_documentation/configuration.rb', line 7 def full_backtrace @full_backtrace end |
#hooks ⇒ Object (readonly)
Returns the value of attribute hooks.
6 7 8 |
# File 'lib/rspec_documentation/configuration.rb', line 6 def hooks @hooks end |
#index_search ⇒ Object
Returns the value of attribute index_search.
7 8 9 |
# File 'lib/rspec_documentation/configuration.rb', line 7 def index_search @index_search end |
#max_height ⇒ Object
Returns the value of attribute max_height.
7 8 9 |
# File 'lib/rspec_documentation/configuration.rb', line 7 def max_height @max_height end |
#table_of_contents ⇒ Object
Returns the value of attribute table_of_contents.
7 8 9 |
# File 'lib/rspec_documentation/configuration.rb', line 7 def table_of_contents @table_of_contents end |
Instance Method Details
#attribution ⇒ Object
24 25 26 27 28 29 |
# File 'lib/rspec_documentation/configuration.rb', line 24 def attribution return @attribution if defined?(@attribution) 'Documentation generated by ' \ '<a target="_blank" href="https://github.com/bobf/rspec-documentation">rspec-documentation</a>' end |
#context(&block) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/rspec_documentation/configuration.rb', line 31 def context(&block) raise Error, 'RSpecDocumentation context has already been defined.' if context_defined? @context_defined = true ::RSpec.shared_context('__rspec_documentation', &block) end |
#context_defined? ⇒ Boolean
20 21 22 |
# File 'lib/rspec_documentation/configuration.rb', line 20 def context_defined? @context_defined end |
#hook(name, &block) ⇒ Object
38 39 40 |
# File 'lib/rspec_documentation/configuration.rb', line 38 def hook(name, &block) hooks[name] = block end |