Class: Gitlab::Graphql::Queries::Fragments

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/graphql/queries.rb

Overview

TODO: some queries live under app/graphql/queries - we should look there if/when we add fragments there See: https://gitlab.com/gitlab-org/gitlab/-/issues/361079 for fragments too.

Instance Method Summary collapse

Constructor Details

#initialize(root, dir = 'app/assets/javascripts') ⇒ Fragments

Returns a new instance of Fragments.



255
256
257
258
259
# File 'lib/gitlab/graphql/queries.rb', line 255

def initialize(root, dir = 'app/assets/javascripts')
  @root = root
  @store = {}
  @dir = dir
end

Instance Method Details

#get(frag_path) ⇒ Object



269
270
271
# File 'lib/gitlab/graphql/queries.rb', line 269

def get(frag_path)
  @store[frag_path] ||= Definition.new(frag_path, self)
end

#homeObject



261
262
263
# File 'lib/gitlab/graphql/queries.rb', line 261

def home
  @home ||= (@root / @dir).to_s
end

#home_eeObject



265
266
267
# File 'lib/gitlab/graphql/queries.rb', line 265

def home_ee
  @home_ee ||= (@root / 'ee' / @dir).to_s
end