File: inherited_hash.rb

package info (click to toggle)
ruby-sass 3.7.4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,396 kB
  • sloc: ruby: 32,443; sh: 26; makefile: 25
file content (41 lines) | stat: -rw-r--r-- 1,491 bytes parent folder | download | duplicates (11)
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
class InheritedHashHandler < YARD::Handlers::Ruby::Legacy::Base
  handles /\Ainherited_hash(\s|\()/

  def process
    hash_name = tokval(statement.tokens[2])
    name = statement.comments.first.strip
    type = statement.comments[1].strip

    o = register(MethodObject.new(namespace, hash_name, scope))
    o.docstring = [
      "Gets a #{name} from this {Environment} or one of its \\{#parent}s.",
      "@param name [String] The name of the #{name}",
      "@return [#{type}] The #{name} value",
    ]
    o.signature = true
    o.parameters = ["name"]

    o = register(MethodObject.new(namespace, "set_#{hash_name}", scope))
    o.docstring = [
      "Sets a #{name} in this {Environment} or one of its \\{#parent}s.",
      "If the #{name} is already defined in some environment,",
      "that one is set; otherwise, a new one is created in this environment.",
      "@param name [String] The name of the #{name}",
      "@param value [#{type}] The value of the #{name}",
      "@return [#{type}] `value`",
    ]
    o.signature = true
    o.parameters = ["name", "value"]

    o = register(MethodObject.new(namespace, "set_local_#{hash_name}", scope))
    o.docstring = [
      "Sets a #{name} in this {Environment}.",
      "Ignores any parent environments.",
      "@param name [String] The name of the #{name}",
      "@param value [#{type}] The value of the #{name}",
      "@return [#{type}] `value`",
    ]
    o.signature = true
    o.parameters = ["name", "value"]
  end
end