Module: CiteProc::Asset::ClassMethods

Defined in:
lib/citeproc/assets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#extensionObject

Returns the value of attribute extension.



57
58
59
# File 'lib/citeproc/assets.rb', line 57

def extension
  @extension
end

#prefixObject

Returns the value of attribute prefix.



57
58
59
# File 'lib/citeproc/assets.rb', line 57

def prefix
  @prefix
end

#rootObject

Returns the value of attribute root.



57
58
59
# File 'lib/citeproc/assets.rb', line 57

def root
  @root
end

Instance Method Details

#extend_name(input) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/citeproc/assets.rb', line 67

def extend_name(input)
  if File.extname(input) != extension
    name = [input, extension].compact.join
  else
    name = input.to_s.dup
  end

  unless name.start_with?(prefix.to_s)
    name = [prefix, name].join
  end

  name
end

#extend_path(input) ⇒ Object



63
64
65
# File 'lib/citeproc/assets.rb', line 63

def extend_path(input)
  File.join(root.to_s, extend_name(input))
end

#open(path_or_name) ⇒ Object



59
60
61
# File 'lib/citeproc/assets.rb', line 59

def open(path_or_name)
  new.open(path_or_name)
end