Module: LogStash::Modules::ResourceBase
- Included in:
- ElasticsearchResource, KibanaBaseResource, KibanaResource
- Defined in:
- lib/logstash/modules/resource_base.rb
Instance Attribute Summary collapse
- 
  
    
      #base  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute base. 
- 
  
    
      #content_id  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute content_id. 
- 
  
    
      #content_path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute content_path. 
- 
  
    
      #content_type  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute content_type. 
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #contains?(text) ⇒ Boolean
- #content ⇒ Object
- #content_as_object ⇒ Object
- #initialize(base, content_type, content_path, content = nil, content_id = nil) ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
| 6 7 8 | # File 'lib/logstash/modules/resource_base.rb', line 6 def base @base end | 
#content_id ⇒ Object (readonly)
Returns the value of attribute content_id.
| 6 7 8 | # File 'lib/logstash/modules/resource_base.rb', line 6 def content_id @content_id end | 
#content_path ⇒ Object (readonly)
Returns the value of attribute content_path.
| 6 7 8 | # File 'lib/logstash/modules/resource_base.rb', line 6 def content_path @content_path end | 
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
| 6 7 8 | # File 'lib/logstash/modules/resource_base.rb', line 6 def content_type @content_type end | 
Instance Method Details
#<=>(other) ⇒ Object
| 30 31 32 | # File 'lib/logstash/modules/resource_base.rb', line 30 def <=>(other) to_s <=> other.to_s end | 
#==(other) ⇒ Object
| 34 35 36 | # File 'lib/logstash/modules/resource_base.rb', line 34 def ==(other) to_s == other.to_s end | 
#contains?(text) ⇒ Boolean
| 22 23 24 | # File 'lib/logstash/modules/resource_base.rb', line 22 def contains?(text) content.include?(text) end | 
#content ⇒ Object
| 14 15 16 | # File 'lib/logstash/modules/resource_base.rb', line 14 def content @content ||= FileReader.read(@content_path) end | 
#content_as_object ⇒ Object
| 26 27 28 | # File 'lib/logstash/modules/resource_base.rb', line 26 def content_as_object LogStash::Json.load(content) rescue nil end | 
#initialize(base, content_type, content_path, content = nil, content_id = nil) ⇒ Object
| 8 9 10 11 12 | # File 'lib/logstash/modules/resource_base.rb', line 8 def initialize(base, content_type, content_path, content = nil, content_id = nil) @base, @content_type, @content_path = base, content_type, content_path @content_id = content_id || ::File.basename(@content_path, ".*") @content = content end | 
#to_s ⇒ Object
| 18 19 20 | # File 'lib/logstash/modules/resource_base.rb', line 18 def to_s "#{base}, #{content_type}, #{content_path}, #{content_id}" end |