Module: Bridgetown

Defined in:
lib/bridgetown/version.rb,
lib/bridgetown-foundation.rb,
lib/bridgetown/foundation/refine_ext/hash.rb,
lib/bridgetown/foundation/refine_ext/module.rb,
lib/bridgetown/foundation/refine_ext/object.rb,
lib/bridgetown/foundation/refine_ext/string.rb,
lib/bridgetown/foundation/refine_ext/deep_duplicatable.rb

Defined Under Namespace

Modules: Foundation, Refinements Classes: WrappedObjectWithRefinements

Constant Summary collapse

VERSION =
"2.2.0"
CODE_NAME =
"Verdant River City"
Inflector =

compatibility alias

Foundation::Inflector

Class Method Summary collapse

Class Method Details

.add_refinement(mod) ⇒ Object



73
74
75
76
# File 'lib/bridgetown-foundation.rb', line 73

def self.add_refinement(mod, &)
  Bridgetown::Refinements.include(mod)
  Bridgetown::WrappedObjectWithRefinements.class_eval(&)
end

.refine(*obj) ⇒ WrappedObjectWithRefinements

Call this method to wrap any object(s) in order to use Foundation’s refinements

Parameters:

  • *obj (Object)

Returns:



65
66
67
68
69
70
71
# File 'lib/bridgetown-foundation.rb', line 65

def self.refine(*obj)
  if obj.length == 1
    WrappedObjectWithRefinements.new(obj[0])
  else
    obj.map { WrappedObjectWithRefinements.new _1 }
  end
end