Module: Brutal::File

Defined in:
lib/brutal/file.rb,
lib/brutal/file/read.rb,
lib/brutal/file/write.rb

Overview

Brutal::File

Defined Under Namespace

Classes: Read, Write

Constant Summary collapse

DEFAULT_CONFIG_FILENAME =
".brutal.yml"
DEFAULT_GENERATED_FILENAME =
"test.rb"
RUBY_EXTENSION =
".rb"

Class Method Summary collapse

Class Method Details

.generated_pathname(pathname) ⇒ Object



15
16
17
18
19
20
# File 'lib/brutal/file.rb', line 15

def self.generated_pathname(pathname)
  filename = pathname.basename
  return pathname.dirname + DEFAULT_GENERATED_FILENAME if default_config_filename?(filename)

  pathname.sub_ext(RUBY_EXTENSION)
end

.override_protection(pathname) ⇒ Object



22
23
24
# File 'lib/brutal/file.rb', line 22

def self.override_protection(pathname)
  abort "A #{pathname} file already exists!" if pathname.exist?
end