Module: Polyfillrb

Defined in:
lib/polyfillrb.rb,
lib/polyfillrb/version.rb,
lib/polyfillrb/rails/railtie.rb,
lib/polyfillrb/rails/view_helper.rb

Defined Under Namespace

Modules: Rails

Constant Summary collapse

PROJECT_DIRECTORY =
File.expand_path(File.dirname(__FILE__))
VERSION =
'1.1.1'

Class Method Summary collapse

Class Method Details

.get_polyfills(ua, minify = false) ⇒ Object

Method to get the polyfills

Params

ua -> User Agent String
minify -> Boolean if code should be minified or not

returns String



15
16
17
# File 'lib/polyfillrb.rb', line 15

def self.get_polyfills(ua, minify=false)
  return %x( node #{PROJECT_DIRECTORY}/polyfill.js -p "#{ua}" #{minify})
end

.has_built_sources?Boolean

Detects if the service has installed it’s dependencies

Returns:

  • (Boolean)


26
27
28
# File 'lib/polyfillrb.rb', line 26

def self.has_built_sources?
  Dir.exist?(PROJECT_DIRECTORY+'/polyfill-service/node_modules/')
end

.has_installed_service?Boolean

Detects if the service has been downloaded from git yet

Returns:

  • (Boolean)


21
22
23
# File 'lib/polyfillrb.rb', line 21

def self.has_installed_service?
  Dir.exist?(PROJECT_DIRECTORY+'/polyfill-service/')
end