Class: Apipie::Generator::Swagger::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/apipie/generator/swagger/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allow_null:, http_method:, controller_method:, prefix: nil, default_in_value: nil, language: nil, in_schema: true) ⇒ Context

Returns a new instance of Context.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/apipie/generator/swagger/context.rb', line 5

def initialize(
  allow_null:,
  http_method:,
  controller_method:,
  prefix: nil,
  default_in_value: nil,
  language: nil,
  in_schema: true
)
  @default_in_value = default_in_value
  @allow_null = allow_null
  @language = language
  @in_schema = in_schema
  @http_method = http_method
  @controller_method = controller_method
  @prefix = prefix
end

Instance Attribute Details

#controller_methodObject (readonly)

Returns the value of attribute controller_method.



2
3
4
# File 'lib/apipie/generator/swagger/context.rb', line 2

def controller_method
  @controller_method
end

#default_in_valueObject (readonly)

Returns the value of attribute default_in_value.



2
3
4
# File 'lib/apipie/generator/swagger/context.rb', line 2

def default_in_value
  @default_in_value
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



2
3
4
# File 'lib/apipie/generator/swagger/context.rb', line 2

def http_method
  @http_method
end

#languageObject (readonly)

Returns the value of attribute language.



2
3
4
# File 'lib/apipie/generator/swagger/context.rb', line 2

def language
  @language
end

#prefixObject (readonly)

Returns the value of attribute prefix.



2
3
4
# File 'lib/apipie/generator/swagger/context.rb', line 2

def prefix
  @prefix
end

Instance Method Details

#add_to_prefix!(prefix) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/apipie/generator/swagger/context.rb', line 31

def add_to_prefix!(prefix)
  @prefix = if @prefix.present?
              "#{@prefix}[#{prefix}]"
            else
              prefix
            end
end

#allow_null?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/apipie/generator/swagger/context.rb', line 23

def allow_null?
  @allow_null == true
end

#in_schema?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/apipie/generator/swagger/context.rb', line 27

def in_schema?
  @in_schema == true
end