class Hobby::JSON::Keys::Type
Attributes
gates[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/hobby/json/keys.rb, line 140 def initialize &block @gates = {} instance_exec &block end
Public Instance Methods
===(it)
click to toggle source
# File lib/hobby/json/keys.rb, line 180 def === it @gates.values.each do |gate| fail unless gate === it end end
expand(&block)
click to toggle source
# File lib/hobby/json/keys.rb, line 147 def expand &block new_type = dup new_type.instance_exec &block new_type end
initialize_copy(original)
click to toggle source
Calls superclass method
# File lib/hobby/json/keys.rb, line 153 def initialize_copy original super @gates = original.gates.dup end
is_a(type)
click to toggle source
# File lib/hobby/json/keys.rb, line 158 def is_a type @gates[__callee__] = -> it { it.is_a? type } end
is_not_empty()
click to toggle source
# File lib/hobby/json/keys.rb, line 164 def is_not_empty @gates[__callee__] = -> it { not it.empty? } end
may_be_empty()
click to toggle source
# File lib/hobby/json/keys.rb, line 170 def may_be_empty @gates.delete :is_not_empty end
size(value)
click to toggle source
# File lib/hobby/json/keys.rb, line 174 def size value @gates[__callee__] = -> it { value === it.size } end