Sha256: c199c7a8afe413c4560f5e8e1cc80611c46cfd3983ab8785f0816ebc524f6a1c
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
module Checked class Demand class Strings include Uni_Arch::Base include Demand::Base namespace '/string!' route def check! case target when String when StringIO target.rewind request.response.body= target.readlines target.rewind else fail! "...must be a String or StringIO" end end route def include! included = target[matcher] return true if included fail!("...must contain: #{matcher.inspect}") end route def exclude! matcher raise_e = val[matcher] return true unless raise_e fail!("...can't contain #{matcher.inspect}") end route def matches_only! str = target.gsub(matcher, '') if !str.empty? fail!( "...has invalid characters: #{str.inspect}" ) end end route def not_empty! if target.strip.empty? fail!("...can't be empty.") end end route def file_read! request.response.body= target.gsub("\r\n", "\n") end route def new_content! not_empty! file_read! end route def file_content! new_content! end route def hostname! puts target fail!("...has invalid characters: #{$1.inspect}") if target[ %r!([^\dA-Za-z_-]+)! ] end end # === class String end # === class Demand end # === module Checked
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
Checked-1.2.3 | lib/Checked/Demand/Strings.rb |
Checked-1.2.2 | lib/Checked/Demand/Strings.rb |