Sha256: 6d24f05af8d986a1f02600f48e75f6b9f5e02993582498d663df230e1c7a5212
Contents?: true
Size: 839 Bytes
Versions: 8
Compression:
Stored size: 839 Bytes
Contents
# encoding: utf-8 require "logstash/namespace" require_relative "file_reader" module LogStash module Modules module ResourceBase attr_reader :base, :content_type, :content_path, :content_id 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 def content @content ||= FileReader.read(@content_path) end def to_s "#{base}, #{content_type}, #{content_path}, #{content_id}" end def contains?(text) content.include?(text) end def content_as_object LogStash::Json.load(content) rescue nil end def <=>(other) to_s <=> other.to_s end def ==(other) to_s == other.to_s end end end end
Version data entries
8 entries across 8 versions & 2 rubygems