module StringMasterProxy

Public Instance Methods

prep() { |string_master| ... } click to toggle source

This should be used on a String to get access to StringMaster's methods. Two notations are available:

  • Block notation:

    String#prep { |s| s.cut(...); s.break_long_words }
    
  • Chained methods notation

    String#prep.cut(...).break_long_words(...)
    

Beware that in (1) a String object is returned, while in (2) a StringMaster object is returned (although StringMaster has a to_s method).

# File lib/string_master/string_master_proxy.rb, line 12
def prep
  if block_given?
    @string_master ||= StringMaster.new(self)
    self.replace yield(@string_master).to_s
    self
  else
    StringMaster.new(self)
  end
end