class URITemplate::RFC6570::Expression::Unnamed
Public Instance Methods
self_pair(_, value, max_length = 0,&block)
click to toggle source
# File lib/uri_template/rfc6570/expression/unnamed.rb, line 27 def self_pair(_, value, max_length = 0,&block) if block ev = value.map(&block).join(self.class::LIST_CONNECTOR) else ev = escape(value) end cut( ev, max_length ,&block) end
to_r_source()
click to toggle source
# File lib/uri_template/rfc6570/expression/unnamed.rb, line 36 def to_r_source vs = @variable_specs.size - 1 i = 0 source = regex_builder source.group do source.escaped_prefix @variable_specs.each do | var, expand , max_length | last = (vs == i) first = (i == 0) if expand source.group(true) do source.separated_list(first) do source.group do source.character_class('+').reluctant source.escaped_pair_connector end.length('?') source.character_class(max_length) end end else source.escaped_separator unless first source.group(true) do if last source.character_class_with_comma(max_length) else source.character_class(max_length) end end end i = i+1 end end.length('?') return source.join end
Private Instance Methods
after_expand(name, splitted)
click to toggle source
# File lib/uri_template/rfc6570/expression/unnamed.rb, line 83 def after_expand(name, splitted) if splitted.none?{|_,b| b } return [ [ name, splitted.map{|a,_| a } ] ] else return [ [ name, splitted ] ] end end
transform_array(name, ary, expand , max_length)
click to toggle source
Calls superclass method
URITemplate::RFC6570::Expression#transform_array
# File lib/uri_template/rfc6570/expression/unnamed.rb, line 78 def transform_array(name, ary, expand , max_length) return [] if ary.none? super end
transform_hash(name, hsh, expand , max_length)
click to toggle source
Calls superclass method
URITemplate::RFC6570::Expression#transform_hash
# File lib/uri_template/rfc6570/expression/unnamed.rb, line 73 def transform_hash(name, hsh, expand , max_length) return [] if hsh.none? super end