Class: KubeSchema::SchemaIndex
- Inherits:
-
Object
- Object
- KubeSchema::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.
3 4 5 |
# File 'lib/kube_schema/schema_index.rb', line 3 def initialize(version) @version = version end |
Instance Method Details
#all_paths ⇒ Object
11 12 13 |
# File 'lib/kube_schema/schema_index.rb', line 11 def all_paths custom_resource_paths + kubernetes_paths end |
#custom_resource_paths ⇒ Object
15 16 17 18 19 |
# File 'lib/kube_schema/schema_index.rb', line 15 def custom_resource_paths File.read(SCHEMA_INDEX + "/crds.txt").lines.map do |line| line.chomp.gsub(".json", "") end end |
#find(query) ⇒ Object
7 8 9 |
# File 'lib/kube_schema/schema_index.rb', line 7 def find(query) all_paths.select { _1.include?(query.downcase) }.first end |
#kubernetes_paths ⇒ Object
21 22 23 24 25 |
# File 'lib/kube_schema/schema_index.rb', line 21 def kubernetes_paths File.read(SCHEMA_INDEX + "/v#{@version}.txt").lines.map do |line| line.chomp.gsub(".json", "").split("/")[1..-1].join("/") end end |