Class: NamedRoutes::SchemedUri

Inherits:
Object
  • Object
show all
Defined in:
lib/named-routes/schemed_uri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(routes, scheme) ⇒ SchemedUri

Returns a new instance of SchemedUri.



5
6
7
# File 'lib/named-routes/schemed_uri.rb', line 5

def initialize(routes, scheme)
  @routes, @scheme = routes, scheme
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



9
10
11
# File 'lib/named-routes/schemed_uri.rb', line 9

def method_missing(method_name, *args, &block)
  "#{scheme}://#{routes.host}#{routes.send(method_name, *args, &block)}"
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



3
4
5
# File 'lib/named-routes/schemed_uri.rb', line 3

def routes
  @routes
end

#schemeObject (readonly)

Returns the value of attribute scheme.



3
4
5
# File 'lib/named-routes/schemed_uri.rb', line 3

def scheme
  @scheme
end