Module: Twemojify::Configuration

Included in:
Twemojify
Defined in:
lib/twemojify/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
    :base,
    :ext,
    :size,
    :class_name,
    :folder
]
DEFAULT_BASE =
'//twemoji.maxcdn.com/'.freeze
DEFAULT_EXT =
'.png'.freeze
DEFAULT_SIZE =
'36x36'.freeze
DEFAULT_CLASS_NAME =
'emoji'.freeze
DEFAULT_FOLDER =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



25
26
27
# File 'lib/twemojify/configuration.rb', line 25

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



29
30
31
# File 'lib/twemojify/configuration.rb', line 29

def configure
  yield self
end

#optionsObject



33
34
35
36
37
# File 'lib/twemojify/configuration.rb', line 33

def options
  VALID_OPTIONS_KEYS.inject({}) do |option, key|
    option.merge!(key => send(key))
  end
end

#resetObject



39
40
41
42
43
44
45
# File 'lib/twemojify/configuration.rb', line 39

def reset
  self.base = DEFAULT_BASE
  self.ext = DEFAULT_EXT
  self.size = DEFAULT_SIZE
  self.class_name = DEFAULT_CLASS_NAME
  self.folder = DEFAULT_FOLDER
end

#size=(value) ⇒ Object



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

def size=(value)
  @size = Utils.to_size_squared_asset(value)
end