Created
December 28, 2011 18:31
-
-
Save paneq/1529048 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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