Module: SocialiteJs::Source

Defined in:
lib/socialite_js/source.rb,
lib/socialite_js/source/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.bundled_minimized_pathObject



13
14
15
# File 'lib/socialite_js/source.rb', line 13

def self.bundled_minimized_path
  "#{vendor_path}/socialite.min.js"
end

.bundled_pathObject



9
10
11
# File 'lib/socialite_js/source.rb', line 9

def self.bundled_path
  "#{vendor_path}/socialite.js"
end

.method_missing(method_sym, *args, &block) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/socialite_js/source.rb', line 41

def self.method_missing(method_sym, *args, &block)
  if match = respond_to_socialite_extension?(method_sym.to_s)
    "#{vendor_path}/extensions/socialite.#{match['extension_name']}.js"
  else
    super
  end
end

.respond_to?(method_sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
# File 'lib/socialite_js/source.rb', line 33

def self.respond_to?(method_sym, include_private = false)
  if respond_to_socialite_extension? method_sym.to_s
    true
  else
    super
  end
end

.respond_to_socialite_extension?(method_str) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
55
56
57
58
59
60
# File 'lib/socialite_js/source.rb', line 51

def respond_to_socialite_extension? method_str
  # NOTE: not checking if the file actually exists. but checking
  # from a master list of supported extensions
  if (match = method_str.match(/\A(?<extension_name>(.)+)_extension_path\z/)) &&
      supported_extensions.include?(match['extension_name'])
    match
  else
    false
  end
end

.supported_extensionsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/socialite_js/source.rb', line 17

def self.supported_extensions
  %w[bufferapp
   extension-template
   facebook
   github
   googleplus
   hackernews
   linkedin
   pinterest
   spotify
   twitter
   vkontakte
   weibo
   icefy]
end

.vendor_pathObject



5
6
7
# File 'lib/socialite_js/source.rb', line 5

def self.vendor_path
  File.expand_path("../vendor/assets/javascript", __FILE__)
end