Sha256: 6c83c35027c3645bd122adbc29b44b6680e5dcd8b15a076ac3d7765ea54e52d1
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
module Checked class Clean module Mods module Strings def self.apply? d d.target.is_a?(String) || d.target.is_a?(StringIO) end def self.on_apply d case d.target when StringIO d.target.rewind d.target= d.target.readlines else # Do nothing. end end def file_names matcher strip.split.select { |word| word[matcher] } end def file_names_by_ext ext names = file_names(ext) bases = names.map { |s| s.sub(%r!#{ext}$!, '') } names.zip bases end def shell target .strip .split("\n") .map(&:strip) .reject { |line| line.empty? } .join(' && ') end def chop_ext target.sub /\.[^\.]+$/, '' end def ruby_name c = ::Checked::Clean.new( File.basename( target ) ) c.< :chop_rb c.target end def chop_rb target.sub %r!\.rb$!, '' end def chop_slash_r target.gsub "\r", '' end def os_stardard chop_slash_r.strip end def file_names matcher strip.split.select { |word| word[matcher] } end def file_names_by_ext ext names = file_names(ext) bases = names.map { |s| s.sub(%r!#{ext}$!, '') } names.zip bases end def to_single target.gsub( /s\Z/, '' ) end def to_plural target.to_single + 's' end def to_class_name target.split('_').map(&:capitalize).join('_') end def to_camel_case target.split('_').map(&:capitalize).join end end # === module Strings end # === module Mods end # === class Clean end # === module Checked
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
Checked-0.1.1 | lib/Checked/Clean/Mods/Strings.rb |
Checked-0.1.0 | lib/Checked/Clean/Mods/Strings.rb |