Skip to content

Instantly share code, notes, and snippets.

@paneq
Created December 28, 2011 18:31
Show Gist options
  • Save paneq/1529048 to your computer and use it in GitHub Desktop.
Save paneq/1529048 to your computer and use it in GitHub Desktop.
class InvalidLengthError
attr_accessor :min, :max, :current
private :min=, :max=, :current=
CODE = "INVALID_LENGTH"
DESCRIPTION = "Invalid length"
def initialize(min, max, current)
self.min = min
self.max = max
self.current = current
end
def code
CODE
end
def description
DESCRIPTION
end
def empty?
false
end
def as_json(options = {})
{
code: code,
description: description,
min: min,
max: max,
current: current
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment