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: 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.



248
249
250
251
252
# File 'lib/gitlab/graphql/queries.rb', line 248

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

Instance Method Details

#get(frag_path) ⇒ Object



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

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

#homeObject



254
255
256
# File 'lib/gitlab/graphql/queries.rb', line 254

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

#home_eeObject



258
259
260
# File 'lib/gitlab/graphql/queries.rb', line 258

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