Module: Emjay::BorderParser

Defined in:
lib/emjay/helpers/shorthand_parser.rb

Class Method Summary collapse

Class Method Details

.call(border) ⇒ Object

Extracts the first number from a border string (e.g. “1px solid black” -> 1). Port of borderParser in shorthandParser.js



28
29
30
31
# File 'lib/emjay/helpers/shorthand_parser.rb', line 28

def self.call(border)
  match = border.to_s.match(/(?:(?:^| )(\d+))/)
  match ? match[1].to_i : 0
end