Class: Rant::RantVar::Constraints::String

Inherits:
Object
  • Object
show all
Includes:
Constraint
Defined in:
lib/rant/import/var/strings.rb

Direct Known Subclasses

ToString

Instance Method Summary collapse

Instance Method Details

#defaultObject


25
26
27
# File 'lib/rant/import/var/strings.rb', line 25

def default
    ""
end

#filter(val) ⇒ Object


16
17
18
19
20
21
22
23
24
# File 'lib/rant/import/var/strings.rb', line 16

def filter(val)
    if val.respond_to? :to_str
	val.to_str
    elsif Symbol === val
	val.to_s
    else
	raise ConstraintError.new(self, val)
    end
end

#to_sObject


28
29
30
# File 'lib/rant/import/var/strings.rb', line 28

def to_s
    "string"
end