Skip to content

Methods should appear as separate "islands" #1

@louismrose

Description

@louismrose
class HelloWorld
  attr_reader :name

  def initialize(name = "world")
    @name = name
  end

  def run
    puts "Hello, #{name}!"
  end
end

HelloWorld.new.run

produces the CFG:

cfg

Note that there are two problems here:

  • There are no nodes for the run method.
  • It's not immediately obvious which "island" originates from which part of the program. (In this case, the left-most island is the class definition and the call to HelloWorld.new.run and the right-most island is initialize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions