Class: Regexp

Inherits:
Object
  • Object
show all
Defined in:
lib/branch_io_cli/core_ext/regexp.rb

Instance Method Summary collapse

Instance Method Details

#match_file(file) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/branch_io_cli/core_ext/regexp.rb', line 2

def match_file(file)
  case file
  when File
    contents = file.read
  when String
    contents = File.read file
  else
    raise ArgumentError, "Invalid argument type: #{file.class.name}"
  end

  match contents
end

#match_file?(file) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/branch_io_cli/core_ext/regexp.rb', line 15

def match_file?(file)
  !match_file(file).nil?
end