File: rp_extensions.rb

package info (click to toggle)
ruby-ruby-parser 3.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,180 kB
  • sloc: ruby: 124,525; yacc: 35,033; makefile: 11
file content (53 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# :stopdoc:
# WHY do I have to do this?!?
class Regexp
  ONCE = 0 unless defined? ONCE # FIX: remove this - it makes no sense

  unless defined? ENC_NONE then
    ENC_NONE = /x/n.options
    ENC_EUC  = /x/e.options
    ENC_SJIS = /x/s.options
    ENC_UTF8 = /x/u.options
  end
end
# :startdoc:

class Array
  def prepend *vals
    self[0,0] = vals
  end
end unless [].respond_to?(:prepend)

# :stopdoc:
class Symbol
  def end_with? o
    self.to_s.end_with? o
  end
end unless :woot.respond_to?(:end_with?)
# :startdoc:

############################################################
# HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK

class String
  def clean_caller
    self.sub(File.dirname(__FILE__), "./lib").sub(/:in.*/, "")
  end if $DEBUG
end

require "sexp"

class Sexp
  attr_writer :paren # TODO: retire

  def paren
    @paren ||= false
  end

  def block_pass?
    any? { |s| Sexp === s && s.sexp_type == :block_pass }
  end
end

# END HACK
############################################################