File: ruby2_keywords.rb

package info (click to toggle)
ruby-ruby2-keywords 0.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 112 kB
  • sloc: ruby: 87; makefile: 4
file content (57 lines) | stat: -rw-r--r-- 1,114 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
54
55
56
57
class Module
  unless private_method_defined?(:ruby2_keywords)
    private
    # call-seq:
    #    ruby2_keywords(method_name, ...)
    #
    # Does nothing.
    def ruby2_keywords(name, *)
      # nil
    end
  end
end

main = TOPLEVEL_BINDING.eval('self')
unless main.respond_to?(:ruby2_keywords, true)
  # call-seq:
  #    ruby2_keywords(method_name, ...)
  #
  # Does nothing.
  def main.ruby2_keywords(name, *)
    # nil
  end
end

class Proc
  unless method_defined?(:ruby2_keywords)
    # call-seq:
    #    proc.ruby2_keywords -> proc
    #
    # Does nothing and just returns the receiver.
    def ruby2_keywords
      self
    end
  end
end

class << Hash
  unless method_defined?(:ruby2_keywords_hash?)
    # call-seq:
    #    Hash.ruby2_keywords_hash?(hash) -> false
    #
    # Returns false.
    def ruby2_keywords_hash?(hash)
      false
    end
  end

  unless method_defined?(:ruby2_keywords_hash)
    # call-seq:
    #    Hash.ruby2_keywords_hash(hash) -> new_hash
    #
    # Duplicates a given hash and returns the new hash.
    def ruby2_keywords_hash(hash)
      hash.dup
    end
  end
end