Module: BrowserShooter::Utils

Defined in:
lib/browser_shooter/utils.rb

Class Method Summary collapse

Class Method Details

.find_by_name(array, name) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
12
# File 'lib/browser_shooter/utils.rb', line 7

def self.find_by_name( array, name )
  element = array.select{ |e| e.name == name }.first
  raise ArgumentError, "Not element found '#{name}'" if element.nil?

  element
end

.find_by_names(array, names) ⇒ Object



14
15
16
# File 'lib/browser_shooter/utils.rb', line 14

def self.find_by_names( array, names )
  names.map { |name| find_by_name( array, name ) }
end

.timestampObject



3
4
5
# File 'lib/browser_shooter/utils.rb', line 3

def self.timestamp
  Time.now.strftime( "%Y%m%d%H%M%S" )
end