Class: Kube::Schema::SchemaIndex
- Inherits:
-
Object
- Object
- Kube::Schema::SchemaIndex
- Defined in:
- lib/kube/schema/schema_index.rb
Instance Method Summary collapse
- #all_paths ⇒ Object
- #custom_resource_paths ⇒ Object
- #find(query) ⇒ Object
-
#initialize(version) ⇒ SchemaIndex
constructor
A new instance of SchemaIndex.
- #kubernetes_paths ⇒ Object
Constructor Details
#initialize(version) ⇒ SchemaIndex
Returns a new instance of SchemaIndex.
4 5 6 |
# File 'lib/kube/schema/schema_index.rb', line 4 def initialize(version) @version = version end |
Instance Method Details
#all_paths ⇒ Object
12 13 14 |
# File 'lib/kube/schema/schema_index.rb', line 12 def all_paths kubernetes_paths + custom_resource_paths end |
#custom_resource_paths ⇒ Object
16 17 18 19 20 |
# File 'lib/kube/schema/schema_index.rb', line 16 def custom_resource_paths File.read(SCHEMA_INDEX + "/crds.txt").lines.map do |line| line.chomp.gsub(".json", "") end end |
#find(query) ⇒ Object
8 9 10 |
# File 'lib/kube/schema/schema_index.rb', line 8 def find(query) all_paths.select { _1.include?(query.downcase) }.first end |
#kubernetes_paths ⇒ Object
22 23 24 25 26 |
# File 'lib/kube/schema/schema_index.rb', line 22 def kubernetes_paths File.read(SCHEMA_INDEX + "/v#{@version}.txt").lines.map do |line| line.chomp.gsub(".json", "") end end |