Search
 
SCRIPT & CODE EXAMPLE
 

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!
Comment

PREVIOUS NEXT
Code Example
Ruby :: how to run ruby classes 
Ruby :: how to differentiate get and post when it has same name in rails 
Ruby :: why do i ineed to reset rails server 
Ruby :: rails migration remove column 
Ruby :: deep copy and shallow copy in ruby 
Ruby :: rails increment counter model 
Ruby :: object service 
Ruby :: rails g migration foreign key optionnal 
Ruby :: rails log levels 
Ruby :: rails api 
Ruby :: rails check if object is new 
Ruby :: important topic on ruby 
Ruby :: intermediate rails project 
Ruby :: rails notprecompiled 
Ruby :: include module in rails different folder in rails 
Ruby :: ruby regex replace capture group 
Ruby :: pick element from space separated list that is part of params hash 
Ruby :: rails spreadsheet email attachment 
Ruby :: rails do something for 3 minutes 
Ruby :: is this consistent with ruby-class A<b::c::C::D::e 
R :: add a vertical line in ggplot 
R :: R sort matrix 
R :: Error in value[[3L]](cond) : Package ‘lavaan’ version 0.6.8 cannot be unloaded: 
R :: how to eliminate duplicates in a column in r 
R :: how to read a vector input in r 
R :: correlation matrix in r 
R :: how to convert numeric to date in r 
R :: mutate in r if else 
R :: reorder columns in r 
R :: r remove column by index 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =