class Safrano::Expand

single expand

Constants

DEEPH_0

used for Sequel eager argument Recursive array to deep hash

1,2,3,4

–> {1=>{2=>{3=>4}}}

1

–> 1

DEEPH_1

used for building output template Recursive array to deep hash

1,2,3,4

–> {1=>{2=>{3=>4}}}

1

–> { 1 => {} }

NODESEP

Attributes

arg[R]

sequel eager arg.

template[R]

Public Class Methods

new(exstr) click to toggle source
# File lib/odata/expand.rb, line 57
def initialize(exstr)
  exstr.strip!
  @expandp = exstr
  @nodes = @expandp.split(NODESEP)
  build_arg
end

Public Instance Methods

apply_to_dataset(dtcx) click to toggle source
# File lib/odata/expand.rb, line 64
def apply_to_dataset(dtcx)
  Contract.valid(dtcx)
end
build_arg() click to toggle source
# File lib/odata/expand.rb, line 68
def build_arg
  #   'a/b/c/d'  ==> {a: {b:{c: :d}}}
  #   'xy'  ==> :xy
  @arg = DEEPH_0.call(@nodes.map(&:to_sym))
  @template = DEEPH_1.call(@nodes)
end
empty?() click to toggle source
# File lib/odata/expand.rb, line 75
def empty?
  false
end