Module: Shaf::ResourceUris

Defined in:
lib/shaf/extensions/resource_uris.rb

Defined Under Namespace

Classes: UriHelperMethodAlreadyExistError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register_uri(name, uri) ⇒ Object



19
20
21
# File 'lib/shaf/extensions/resource_uris.rb', line 19

def register_uri(name, uri)
  MethodBuilder.new(name, uri).call
end

.resource_uris_for(name, **kwargs) ⇒ Object



15
16
17
# File 'lib/shaf/extensions/resource_uris.rb', line 15

def resource_uris_for(name, **kwargs)
  CreateUriMethods.new(name, **kwargs).call
end

Instance Method Details

#register_uri(name, uri) ⇒ Object



31
32
33
34
35
36
# File 'lib/shaf/extensions/resource_uris.rb', line 31

def register_uri(name, uri)
  result = ResourceUris.register_uri(name, uri)
  UriHelperMethods.add_path_helpers(self, result)

  include UriHelper unless self < UriHelper
end

#resource_uris_for(name, **kwargs) ⇒ Object



24
25
26
27
28
29
# File 'lib/shaf/extensions/resource_uris.rb', line 24

def resource_uris_for(name, **kwargs)
  result = ResourceUris.resource_uris_for(name, **kwargs)
  UriHelperMethods.add_path_helpers(self, result)

  include UriHelper unless self < UriHelper
end