Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby refinement include module

module SomeModule
  def new_method
    puts 'its me, the new method!'
  end
end

module SomeRefinement
  refine String do
    import_methods SomeModule
  end
end

using SomeRefinement
string = ""
string.new_method #=> its me, the new method!
 
PREVIOUS NEXT
Tagged: #ruby #refinement #include #module
ADD COMMENT
Topic
Name
8+9 =