R: Fragment

Fragment {ghql} | R Documentation

## Fragment

### Description

ghql fragment class

### Value

a 'Fragment' class (R6 class)

### Public fields

`fragments`

  (list) list of fragments

### Methods

#### Public methods

- `Fragment$print()`

- `Fragment$fragment()`

#### Method `print()`

print method for the 'Fragment' class

##### Usage

    Fragment$print(x, ...)

##### Arguments

`x`

  self

`...`

  ignored

#### Method `fragment()`

create a fragment by name

##### Usage

    Fragment$fragment(name, x)

##### Arguments

`name`

  (character) fragment name

`x`

  (character) the fragment

##### Returns

nothing returned; sets fragments internally

### Examples

    # make a fragment class
    frag <- Fragment$new()

    # define a fragment
    frag$fragment('Watchers', '
      fragment on Repository {
        watchers(first: 3) {
          edges {
            node {
              name
           }
        }
      }
    }')

    # define another fragment
    frag$fragment('Stargazers', '
      fragment on Repository {
        stargazers(first: 3) {
          edges {
            node {
              name
           }
        }
      }
    }')
    frag
    frag$fragments
    frag$fragments$Watchers
    frag$fragments$Stargazers

[Package ghql version 0.1.0 Index]