Class: MenuMaker::Path::Converter::GenericConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/menu_maker/path.rb

Class Method Summary collapse

Class Method Details

.convert(path) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/menu_maker/path.rb', line 58

def self.convert(path)
  unless respond_to_protocol?(path)
    fail PathError, "Don't know how to create path with #{path}"
  end

  Path.new path.method, path.path
end

.respond_to_protocol?(path) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/menu_maker/path.rb', line 66

def self.respond_to_protocol?(path)
  path.respond_to?(:path) && path.respond_to?(:method)
end