Class: GrapeMarkdown::Configuration
- Inherits:
-
Object
- Object
- GrapeMarkdown::Configuration
- Defined in:
- lib/grape-markdown/configuration.rb
Constant Summary collapse
- SETTINGS =
[ :name, :description, :request_headers, :response_headers, :example_id_type, :resource_exclusion, :include_root ]
Class Method Summary collapse
- .example_id_type ⇒ Object
- .example_id_type=(value) ⇒ Object
- .extend(setting) ⇒ Object
- .generate_id ⇒ Object
- .include_root ⇒ Object
- .request_headers ⇒ Object
- .resource_exclusion ⇒ Object
- .response_headers ⇒ Object
- .supported_id_types ⇒ Object
Class Method Details
.example_id_type ⇒ Object
50 51 52 |
# File 'lib/grape-markdown/configuration.rb', line 50 def example_id_type @example_id_type ||= :integer end |
.example_id_type=(value) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/grape-markdown/configuration.rb', line 40 def example_id_type=(value) fail UnsupportedIDType unless supported_id_types.include?(value) if value.to_sym == :bson && !Object.const_defined?('BSON') fail BSONNotDefinied end @example_id_type = value end |
.extend(setting) ⇒ Object
16 17 18 |
# File 'lib/grape-markdown/configuration.rb', line 16 def extend(setting) self.class.send :attr_accessor, setting end |
.generate_id ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/grape-markdown/configuration.rb', line 54 def generate_id case example_id_type when :integer SecureRandom.random_number(1000) when :uuid SecureRandom.uuid when :bson BSON::ObjectId.new.to_s end end |
.include_root ⇒ Object
32 33 34 |
# File 'lib/grape-markdown/configuration.rb', line 32 def include_root @include_root ||= false end |
.request_headers ⇒ Object
20 21 22 |
# File 'lib/grape-markdown/configuration.rb', line 20 def request_headers @request_headers ||= [] end |
.resource_exclusion ⇒ Object
28 29 30 |
# File 'lib/grape-markdown/configuration.rb', line 28 def resource_exclusion @resource_exclusion ||= [] end |
.response_headers ⇒ Object
24 25 26 |
# File 'lib/grape-markdown/configuration.rb', line 24 def response_headers @response_headers ||= [] end |
.supported_id_types ⇒ Object
36 37 38 |
# File 'lib/grape-markdown/configuration.rb', line 36 def supported_id_types [:integer, :uuid, :bson] end |