Class: Shep::URIBox

Inherits:
TypeBox show all
Defined in:
lib/shep/typeboxes.rb

Instance Method Summary collapse

Methods inherited from TypeBox

#==, #get, #initialize, #inspect, #set, #set?, #to_s, to_yard_s, #unset?

Constructor Details

This class inherits a constructor from Shep::TypeBox

Instance Method Details

#check(v) ⇒ Object

Raises:



92
93
94
# File 'lib/shep/typeboxes.rb', line 92

def check(v)
  raise Error::Type.new(@desc, v, URI::Generic) unless v.is_a?(URI::Generic)
end

#get_for_jsonObject



95
# File 'lib/shep/typeboxes.rb', line 95

def get_for_json = unset? ? @value : @value.to_s

#set_from_json(v) ⇒ Object



96
# File 'lib/shep/typeboxes.rb', line 96

def set_from_json(v) = set( (v == nil) ? v : URI(v) )