server/lib/cimi/model/base.rb
#
# We keep the values of the attributes in a hash
#
We keep the values of the attributes in a hash
We keep the values of the attributes in a hash
def filter_by(filter_opts)
    return self if filter_opts.nil?
    return filter_attributes(filter_opts.split(',').map{ |a| a.intern }) if filter_opts.include? ','
    case filter_opts
      when /^([\w\_]+)$/ then filter_attributes([$1.intern])
      when /^([\w\_]+)\[(\d+\-\d+)\]$/ then filter_by_arr_range($1.intern, $2)
      when /^([\w\_]+)\[(\d+)\]$/ then filter_by_arr_index($1.intern, $2)
      else self
    end
  end
def filter_by ( filter_opts ) return self if filter_opts . nil? return filter_attributes ( filter_opts . split ( ',' ) . map { | a | a . intern } ) if filter_opts . include? ',' case filter_opts when / ^([ \w \_ ]+)$ / then filter_attributes ( [ $1 . intern ] ) when / ^([ \w \_ ]+) \[ ( \d + \- \d +) \] $ / then filter_by_arr_range ( $1 . intern , $2 ) when / ^([ \w \_ ]+) \[ ( \d +) \] $ / then filter_by_arr_index ( $1 . intern , $2 ) else self end end
We keep the values of the attributes in a hash
We keep the values of the attributes in a hash
filter_opts