Sha256: 1f3ca3cc5d281fbe1052961208194d598a5652241d7b8d60d41d14a047f9b6a3
Contents?: true
Size: 572 Bytes
Versions: 31
Compression:
Stored size: 572 Bytes
Contents
module Troy class Meta extend Forwardable def_delegators :data, :[], :fetch, :key? REGEX = /^---\n(.*?)\n---\n+/m attr_reader :file def initialize(file) @file = file end def content @content ||= raw.gsub(REGEX, "") end def data @data ||= (raw =~ REGEX ? YAML.load(raw[REGEX, 1]) : {}) end def method_missing(name, *args, &block) data[name.to_s] end def respond_to_missing?(method, include_private = false) true end def raw @raw ||= File.read(file) end end end
Version data entries
31 entries across 31 versions & 1 rubygems