Module: Creamerscript::Sweeteners

Defined in:
lib/creamerscript/sweeteners.rb,
lib/creamerscript/sweeteners/base.rb,
lib/creamerscript/sweeteners/array.rb,
lib/creamerscript/sweeteners/object.rb,
lib/creamerscript/sweeteners/string.rb,
lib/creamerscript/sweeteners/version.rb,
lib/creamerscript/sweeteners/js_argument_list.rb,
lib/creamerscript/sweeteners/method_definition.rb,
lib/creamerscript/sweeteners/method_invocation.rb,
lib/creamerscript/sweeteners/property_invocation.rb

Defined Under Namespace

Classes: Array, Base, JSArgumentList, MethodDefinition, MethodInvocation, Object, PropertyInvocation, String

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.eachObject



9
10
11
# File 'lib/creamerscript/sweeteners.rb', line 9

def self.each
  sweeteners.each { |type, sweetener| yield sweetener }
end

.for(type) ⇒ Object



13
14
15
# File 'lib/creamerscript/sweeteners.rb', line 13

def self.for(type)
  sweeteners[type]
end

.register(sweetener) ⇒ Object



5
6
7
# File 'lib/creamerscript/sweeteners.rb', line 5

def self.register(sweetener)
  sweetener.new.tap { |s| sweeteners[s.type] = s }
end

.sweetenersObject



17
18
19
# File 'lib/creamerscript/sweeteners.rb', line 17

def self.sweeteners
  @sweeteners ||= {}
end