Module: Vanillicons::ClassMethods

Defined in:
lib/vanillicons.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#vanillicon_fieldObject (readonly)

Returns the value of attribute vanillicon_field.



12
13
14
# File 'lib/vanillicons.rb', line 12

def vanillicon_field
  @vanillicon_field
end

Instance Method Details

#vanillicon(field, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/vanillicons.rb', line 14

def vanillicon(field, options = {})
  options = options.is_a?(Hash) ? options : {}
  
  # Set the field to generate the url based on
  @vanillicon_field = field
  
  # Merge the options into the default options
  @vanillicon_options = self.vanillicon_defaults.merge(options)      
end

#vanillicon_defaultsObject



24
25
26
27
28
29
# File 'lib/vanillicons.rb', line 24

def vanillicon_defaults
  {
    :secure => true,
    :size => 200
  }
end

#vanillicon_optionsObject



31
32
33
# File 'lib/vanillicons.rb', line 31

def vanillicon_options
  @vanillicon_options || self.vanillicon_defaults
end