Class: Ninsho::RoutesDrawer

Inherits:
Object
  • Object
show all
Defined in:
lib/ninsho/routes_drawer.rb

Overview

Responsible for handling ninsho mappings and routes configuration The required value in ninsho_on is actually not used internally, but it’s inflected to find all other values.

routes_drawer.to #=> Authentication

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ RoutesDrawer

Returns a new instance of RoutesDrawer.



11
12
13
14
15
# File 'lib/ninsho/routes_drawer.rb', line 11

def initialize(name)
  @resource = name.to_s
  @singular_name = name.to_s.singularize
  @klass = Ninsho.ref(@singular_name.classify)
end

Instance Attribute Details

#klassObject (readonly)

:nodoc:



9
10
11
# File 'lib/ninsho/routes_drawer.rb', line 9

def klass
  @klass
end

#resourceObject (readonly)

:nodoc:



9
10
11
# File 'lib/ninsho/routes_drawer.rb', line 9

def resource
  @resource
end

#singular_nameObject (readonly)

:nodoc:



9
10
11
# File 'lib/ninsho/routes_drawer.rb', line 9

def singular_name
  @singular_name
end

Instance Method Details

#toObject

Gives the class the mapping points to.



18
19
20
# File 'lib/ninsho/routes_drawer.rb', line 18

def to
  @klass.get
end