Class: Psych::Visitors::ToRuby

Inherits:
Object
  • Object
show all
Defined in:
lib/claws/cli/yaml_with_lines.rb

Instance Method Summary collapse

Instance Method Details

#accept(target) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/claws/cli/yaml_with_lines.rb', line 19

def accept(target)
  s = super(target)

  # types that we cannot monkey patch into holding line information
  if target.respond_to?(:line) and ![TrueClass, FalseClass, NilClass, Integer, Float].include? s.class
    s.instance_eval do
      extend(Locatable)
    end

    s.line = target.line
  end

  s
end