Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created October 3, 2022 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickanderson/53992381081ded6d67126d340a638937 to your computer and use it in GitHub Desktop.
Save nickanderson/53992381081ded6d67126d340a638937 to your computer and use it in GitHub Desktop.

Example illustrating methods-inherit

bundle agent __main__
{
  methods:
      "parent";

}
bundle agent parent
{
  classes:
      "my_bundle_scoped_class_defined_in_parent";

  methods:
      "Write our child into our will"
        usebundle => child,
        inherit => "true";

      "Step children get the shaft by default"
        usebundle => step_child;

}
bundle agent child
{
  reports:
      "$(this.bundle): I can see my_bundle_scoped_class_defined_in_parent since my parent wrote me into the will."
        if => "my_bundle_scoped_class_defined_in_parent";
      "$(this.bundle): I wasn't written into the will, at least I am not red-headed."
        unless => "my_bundle_scoped_class_defined_in_parent";
}
bundle agent step_child
{
  reports:
      "$(this.bundle): I can see my_bundle_scoped_class_defined_in_parent since my parent wrote me into the will."
        if => "my_bundle_scoped_class_defined_in_parent";
      "$(this.bundle): I wasn't written into the will, at least I am not red-headed."
        unless => "my_bundle_scoped_class_defined_in_parent";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment