Class: Ariadne::Seam

Inherits:
Object
  • Object
show all
Defined in:
lib/ariadne/seam.rb

Defined Under Namespace

Classes: Parameter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#bindingObject (readonly)

Returns the value of attribute binding.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def binding
  @binding
end

#depthObject (readonly)

Returns the value of attribute depth.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def depth
  @depth
end

#klassObject (readonly)

Returns the value of attribute klass.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def klass
  @klass
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def method_name
  @method_name
end

#parametersObject (readonly)

Returns the value of attribute parameters.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def parameters
  @parameters
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def path
  @path
end

#prefixObject (readonly)

Returns the value of attribute prefix.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def prefix
  @prefix
end

#rankObject (readonly)

Returns the value of attribute rank.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def rank
  @rank
end

#return_valueObject (readonly)

Returns the value of attribute return_value.



7
8
9
# File 'lib/ariadne/seam.rb', line 7

def return_value
  @return_value
end

Class Method Details

.build(tracepoint, rank:, depth:) ⇒ Object

We cannot make public methods because accessing the TracePoint after it has been disabled would raise a RunTimeError with message “access from outside”. We need to set the values while the TracePoint is enabled.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ariadne/seam.rb', line 16

def build(tracepoint, rank:, depth:)
  raise "tracepoint is disabled" unless tracepoint.enabled?

  new(rank: rank, depth: depth).tap do |seam|
    seam.instance_variable_set(:@klass, klass(tracepoint))
    seam.instance_variable_set(:@prefix, prefix(tracepoint))
    seam.instance_variable_set(:@method_name, method_name(tracepoint))
    seam.instance_variable_set(:@parameters, parameters(tracepoint))
    seam.instance_variable_set(:@path, path(tracepoint))
  end
end