Class: Rundeck::Project::ResourceQueryBuilder
- Inherits:
-
Object
- Object
- Rundeck::Project::ResourceQueryBuilder
- Defined in:
- lib/rundeck-ruby/project.rb
Instance Attribute Summary collapse
-
#precedence ⇒ Object
Returns the value of attribute precedence.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#precedence ⇒ Object
Returns the value of attribute precedence.
54 55 56 |
# File 'lib/rundeck-ruby/project.rb', line 54 def precedence @precedence end |
Class Method Details
.exclude_name(f) ⇒ Object
50 51 52 |
# File 'lib/rundeck-ruby/project.rb', line 50 def self.exclude_name(f) "exclude_#{f}".to_sym end |
.fields ⇒ Object
46 47 48 |
# File 'lib/rundeck-ruby/project.rb', line 46 def self.fields [:name, :hostname, :tags, :os_arch, :os_family, :os_name, :os_version] end |
Instance Method Details
#clause(field) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/rundeck-ruby/project.rb', line 60 def clause(field) val = send(field) return nil unless val name = field.to_s.gsub('_', '-') "#{name}=#{val}" end |
#query ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rundeck-ruby/project.rb', line 67 def query clauses = self.class.fields.map do |f| [ clause(f), clause(self.class.exclude_name(f)) ] end clauses << "exclude-precedence=#{precedence==:exclude ? true : false}" if precedence clauses.flatten.compact.join('&') end |