Class: Jekyll::Minibundle::AssetFileDrop

Inherits:
Liquid::Drop
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/jekyll/minibundle/asset_file_drop.rb

Constant Summary collapse

KEYS =
%w{
  name
  extname
  basename
  modified_time
  path
  collection
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ AssetFileDrop

Returns a new instance of AssetFileDrop.



16
17
18
# File 'lib/jekyll/minibundle/asset_file_drop.rb', line 16

def initialize(file)
  @file = file
end

Instance Method Details

#inspectObject



36
37
38
39
# File 'lib/jekyll/minibundle/asset_file_drop.rb', line 36

def inspect
  require 'json'
  JSON.pretty_generate(to_h)
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/jekyll/minibundle/asset_file_drop.rb', line 20

def key?(key)
  respond_to?(key)
end

#keysObject



24
25
26
# File 'lib/jekyll/minibundle/asset_file_drop.rb', line 24

def keys
  KEYS
end

#to_hObject Also known as: to_hash



28
29
30
31
32
# File 'lib/jekyll/minibundle/asset_file_drop.rb', line 28

def to_h
  keys.each_with_object({}) do |key, acc|
    acc[key] = self[key]
  end
end