class ONIX::SubsetArray

Public Instance Methods

code_match(k, p) click to toggle source
# File lib/onix/subset.rb, line 239
def code_match(k, p)
  case p
  when Regexp
    self.class.new(self.select { |v|
      code = v.instance_variable_get("@" + k.to_s)
      code.code =~ p
    })
  else
    self.class.new(self.select { |v| v.instance_variable_get("@" + k.to_s).code == p })
  end
end
human_code_match(k, p) click to toggle source
# File lib/onix/subset.rb, line 219
def human_code_match(k, p)
  case p
  when Regexp
    self.class.new(self.select { |v|
      code = v.instance_variable_get("@" + k.to_s)
      code and code.human =~ p
    })
  when Array
    self.class.new(self.select { |v|
      code = v.instance_variable_get("@" + k.to_s)
      code and p.include?(code.human)
    })
  else
    self.class.new(self.select { |v|
      code = v.instance_variable_get("@" + k.to_s)
      code and code.human == p
    })
  end
end