Module: Vanillicons::InstanceMethods

Defined in:
lib/vanillicons.rb

Instance Method Summary collapse

Instance Method Details

#vanillicon_hashObject



45
46
47
48
# File 'lib/vanillicons.rb', line 45

def vanillicon_hash
  # Generate hash based on field set
  Digest::MD5.hexdigest(send(vanillicon_field).to_s)
end

#vanillicon_id(size) ⇒ Object



50
51
52
# File 'lib/vanillicons.rb', line 50

def vanillicon_id(size)
  "#{vanillicon_hash}_#{exact_or_larger_size(size)}"
end

#vanillicon_url(options = {}) ⇒ Object



38
39
40
41
42
43
# File 'lib/vanillicons.rb', line 38

def vanillicon_url(options = {})
  options = options.is_a?(Hash) ? options : {}
  options = self.class.vanillicon_options.merge(options)
  
  vanillicon_host(options[:secure]) + vanillicon_id(options[:size]) + vanillicon_image_extension
end