class Makimono::Resource

Constants

ORDERED_BASENAME_REGEXP

Attributes

content[RW]
path[R]

Public Class Methods

new(path, content) click to toggle source
# File lib/makimono/resource.rb, line 10
def initialize(path, content)
  self.path = path
  @content = content
end

Public Instance Methods

basename() click to toggle source
# File lib/makimono/resource.rb, line 23
def basename
  File.basename(path, '.*')
end
basename=(new_basename) click to toggle source
# File lib/makimono/resource.rb, line 27
def basename=(new_basename)
  self.path = "#{dirname}/#{new_basename}#{extname}"
end
dirname() click to toggle source
# File lib/makimono/resource.rb, line 19
def dirname
  File.dirname(path)
end
extname() click to toggle source
# File lib/makimono/resource.rb, line 31
def extname
  File.extname(path)
end
extname=(new_extname) click to toggle source
# File lib/makimono/resource.rb, line 35
def extname=(new_extname)
  self.path = "#{dirname}/#{basename}#{new_extname}"
end
number() click to toggle source
# File lib/makimono/resource.rb, line 43
def number
  basename[ORDERED_BASENAME_REGEXP, :number]&.to_i
end
ordered?() click to toggle source
# File lib/makimono/resource.rb, line 39
def ordered?
  basename.match?(ORDERED_BASENAME_REGEXP)
end
path=(new_path) click to toggle source
# File lib/makimono/resource.rb, line 15
def path=(new_path)
  @path = Pathname.new(new_path).cleanpath.to_s
end
title() click to toggle source
# File lib/makimono/resource.rb, line 47
def title
  basename[ORDERED_BASENAME_REGEXP, :title]
end