lib/codestrap/patch.rb
def mode_line(limit = 10)
        @mode_line ||= begin
                         # Check if file read
          curpos   = self.pos
          self.pos = 0
          lines    = self.readlines()[0 .. (limit - 1)]
          lines.each do |line|
            line =~ /(?:^|\b)(strap|stub):(erb|\S+?)(?:\b|$)/
            if $1
              @mode_line = line
              @template  = $2.to_sym if $2
              @template  = :erb if $2.length == 0
              self.options
            end
            break
          end
          self.pos = curpos
          @mode_line
        end
      end
##
# Set and get mode line status
#
# @param [Integer] limit
#   Number of lines to scan from the top
# @return [true\nil]
Set and get mode line status
Set and get mode line status
def mode_line(limit = 10)
        @mode_line ||= begin
          curpos   = self.pos
          self.pos = 0
          lines    = self.readlines()[0 .. (limit - 1)]
          lines.each do |line|
            line =~ /(?:^|\b)(strap|stub):(erb|\S+?)(?:\b|$)/
            if $1
              @mode_line = line
              @template  = $2.to_sym if $2
              @template  = :erb if $2.length == 0
              self.options
            end
            break
          end
          self.pos = curpos
          @mode_line
        end
      end
def mode_line ( limit = 10 ) @mode_line ||= begin curpos = self . pos self . pos = 0 lines = self . readlines ( ) [ 0 .. ( limit - 1 ) ] lines . each do | line | line =~ / (?:^| \b )(strap|stub):(erb| \S +?)(?: \b |$) / if $1 @mode_line = line @template = $2 . to_sym if $2 @template = :erb if $2 . length == 0 self . options end break end self . pos = curpos @mode_line end end
Set and get mode line status
Set and get mode line status
# Check if file read
None
true\nil
limit
limit Number of lines to scan from the top
limit Number of lines to scan from the top