Sha256: d5db9622e3ad25e0a62b90eb46f899581c11b28e20bbfeda7c19cc4ad4446c3c
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
# encoding: utf-8 module Veritas class Function module String # A class representing a length function class Length < Function include Unary # Return the string length # # @example # length = Length.call(value) # # @param [String] value # # @return [Integer] # # @api public def self.call(value) value.length end # Return the type returned from #call # # @return [Class<Attribute::Integer>] # # @api public def type Attribute::Integer end # Return a string representing the length function # # @example # length.inspect # => 'LENGTH("a string")' # # @return [String] # # @api public def inspect "LENGTH(#{operand.inspect})" end module Methods extend Aliasable # Return a length function # # @example # length = attribute.length # # @return [Length] # # @api public def length Length.new(self) end end # module Methods Attribute::String.class_eval { include Methods } end # class Length end # module String end # class Function end # module Veritas
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.6 | lib/veritas/function/string/length.rb |
veritas-0.0.5 | lib/veritas/function/string/length.rb |
veritas-0.0.4 | lib/veritas/function/string/length.rb |