Sha256: 6c5a168df2308ffb90527d2ddfb8cea7ec3d0cef5160e2b7b93a029ba1b7e2f4
Contents?: true
Size: 400 Bytes
Versions: 4
Compression:
Stored size: 400 Bytes
Contents
module Extract class Expression def initialize(expression, hash) @expression = expression @hash = hash end def evaluate field_name = expression.split.first.parameterize field_value = hash[field_name.to_sym] condition = expression.gsub(field_name, field_value.to_s) eval(condition) end private attr_reader :expression, :hash end end
Version data entries
4 entries across 4 versions & 1 rubygems