class MenuMaker::Path

Constants

METHODS
PathError

Attributes

method[R]
path[R]

Public Class Methods

new(method, path) click to toggle source
# File lib/menu_maker/path.rb, line 11
def initialize(method, path)
  method = method.to_sym.downcase

  unless self.class.valid_method? method
    fail PathError, "Method must be one of: #{METHODS.join(', ')}"
  end

  @method = method
  @path   = path.to_s
end
valid_method?(method) click to toggle source
# File lib/menu_maker/path.rb, line 5
def self.valid_method?(method)
  METHODS.include? method
end

Public Instance Methods

==(other) click to toggle source
# File lib/menu_maker/path.rb, line 22
def ==(other)
  other = Converter.convert(other)
  method == other.method && path == other.path
end
to_s() click to toggle source
# File lib/menu_maker/path.rb, line 27
def to_s
  path
end