Class: StrongRoutes::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/strong_routes/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



14
15
16
17
18
# File 'lib/strong_routes/config.rb', line 14

def initialize
  @allowed_routes = Set.new
  @enabled = true
  @route_matchers = []
end

Instance Attribute Details

#allowed_routesObject

Returns the value of attribute allowed_routes.



11
12
13
# File 'lib/strong_routes/config.rb', line 11

def allowed_routes
  @allowed_routes
end

#contentObject

Returns the value of attribute content.



5
6
7
# File 'lib/strong_routes/config.rb', line 5

def content
  @content
end

#content_typeObject

Returns the value of attribute content_type.



5
6
7
# File 'lib/strong_routes/config.rb', line 5

def content_type
  @content_type
end

#enabledObject

Returns the value of attribute enabled.



5
6
7
# File 'lib/strong_routes/config.rb', line 5

def enabled
  @enabled
end

#insert_afterObject

Returns the value of attribute insert_after.



5
6
7
# File 'lib/strong_routes/config.rb', line 5

def insert_after
  @insert_after
end

#insert_beforeObject

Returns the value of attribute insert_before.



5
6
7
# File 'lib/strong_routes/config.rb', line 5

def insert_before
  @insert_before
end

#route_matchersObject (readonly)

Returns the value of attribute route_matchers.



11
12
13
# File 'lib/strong_routes/config.rb', line 11

def route_matchers
  @route_matchers
end

#statusObject



46
47
48
# File 'lib/strong_routes/config.rb', line 46

def status
  @status ||= 404
end

Instance Method Details

#enabled?Boolean

Returns:



26
27
28
# File 'lib/strong_routes/config.rb', line 26

def enabled?
  !!enabled
end

#headersObject



30
31
32
33
34
35
36
# File 'lib/strong_routes/config.rb', line 30

def headers
  if content.present?
    {Rack::CONTENT_TYPE => content_type || "text/plain"}
  else
    {}
  end
end

#insert_after?Boolean

Returns:



38
39
40
# File 'lib/strong_routes/config.rb', line 38

def insert_after?
  !!insert_after
end

#insert_before?Boolean

Returns:



42
43
44
# File 'lib/strong_routes/config.rb', line 42

def insert_before?
  !!insert_before
end