Module: Bridgetown

Defined in:
lib/bridgetown/version.rb,
lib/bridgetown-foundation.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.0.5"
CODE_NAME =
"River City"

Class Method Summary collapse

Class Method Details

.add_refinement(mod) ⇒ Object



71
72
73
74
# File 'lib/bridgetown-foundation.rb', line 71

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:



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

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