Class/Module Index [+]

Quicksearch

Ruote::Exp::IteratorMixin

A Mixin shared by Ruote::IteratorExpression and Ruote::ConcurrentIteratorExpression

Protected Instance Methods

determine_list() click to toggle source
# File lib/ruote/exp/iterator.rb, line 36
def determine_list

  h.times_iterator = false

  #
  # :times or :branches

  if count = attribute(:times) || attribute(:branches)

    list = ((1..count.to_i).to_a rescue nil)

    if list
      h.times_iterator = true
      return list
    end
  end

  #
  # :on{_...}

  split_list(lookup_val_prefix('on'))
end
split_list(list) click to toggle source
# File lib/ruote/exp/iterator.rb, line 59
def split_list (list)

  if list.is_a?(String)

    sep = attribute(:separator) || attribute(:sep) || ','
    list.split(sep).collect { |e| e.strip }

  elsif list.respond_to?(:to_a)

    list.to_a

  elsif list.respond_to?(:[]) and list.respond_to?(:length)

    list

  else

    []
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.