Module: ThemeJuice::SingletonHelper

Included in:
Env, Project
Defined in:
lib/theme-juice/helpers/singleton_helper.rb

Instance Method Summary collapse

Instance Method Details

#inspectObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/theme-juice/helpers/singleton_helper.rb', line 4

def inspect
  res = []

  self.instance_variables.each do |k, _|
    str = ""
    str << "#{k[1..-1]}: #{instance_variable_get(k)}"
    str << " (#{instance_variable_get(k).class})" if Env.verbose
    res << str
  end

  res.sort
end

#to_hObject



17
18
19
20
21
22
23
24
25
# File 'lib/theme-juice/helpers/singleton_helper.rb', line 17

def to_h
  hash = {}

  self.instance_variables.each do |k, _|
    hash[k[1..-1]] = instance_variable_get k
  end

  hash
end