Sha256: ef6a6024b5ba56647eaf2baf8d98239f28a4e82570dbeed20bd93a6ae001d1e9

Contents?: true

Size: 824 Bytes

Versions: 2

Compression:

Stored size: 824 Bytes

Contents

module Checked
class Demand
module Mods
module File_Addresses

  def self.apply? d
    d.target.is_a?(String)
  end

  def hostname!
    string!
    not_empty!
    contain_only! %r![\dA-Za-z_-]!
  end

  def not_dir!
    string!
    not_empty!
    if File.directory?(target)
      fail! "...can't be a directory."
    end
  end

  def not_file!
    string!
    not_empty!
    if File.file?(target)
      fail! "...can't be a file."
    end
  end

  def dir_address!
    file_address!
  end

  def file_address!
    self.target= target.strip
    string!
    not_empty!
  end

  def file_read!
    self.target= target.gsub("\r\n", "\n")
  end

  def file_content! 
    string!
    not_empty!   
    file_read!
  end
      
end # === module File_Addresses
end # === module Mods
end # === class Demand
end # === module Checked

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Checked-0.1.1 lib/Checked/Demand/Mods/File_Addresses.rb
Checked-0.1.0 lib/Checked/Demand/Mods/File_Addresses.rb