Class: Vivlio::Starter::CLI::TokenResolver::Entry

Inherits:
Data
  • Object
show all
Defined in:
lib/vivlio/starter/cli/token_resolver.rb

Overview

章情報を保持する不変データ構造。Resolver が返す全ての章情報はこの型で統一される。

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#existsObject (readonly)

Returns the value of attribute exists

Returns:

  • (Object)

    the current value of exists



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def exists
  @exists
end

#in_catalogObject (readonly)

Returns the value of attribute in_catalog

Returns:

  • (Object)

    the current value of in_catalog



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def in_catalog
  @in_catalog
end

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def kind
  @kind
end

#labelObject (readonly)

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def label
  @label
end

#numberObject (readonly)

Returns the value of attribute number

Returns:

  • (Object)

    the current value of number



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def number
  @number
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def path
  @path
end

#slugObject (readonly)

Returns the value of attribute slug

Returns:

  • (Object)

    the current value of slug



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def slug
  @slug
end

#validObject (readonly)

Returns the value of attribute valid

Returns:

  • (Object)

    the current value of valid



16
17
18
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 16

def valid
  @valid
end

Instance Method Details

#basenameObject

ファイル名のベース部分を動的に生成する。number と slug から導出されるため、属性間の不整合が発生しない。システムファイル(number=nil)の場合は slug のみを返す。



20
21
22
23
24
25
26
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 20

def basename
  if number
    slug ? "#{number}-#{slug}" : number
  else
    slug
  end
end

#exists?Boolean

exists フラグの述語メソッド。

Returns:

  • (Boolean)


35
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 35

def exists? = exists

#in_catalog?Boolean

in_catalog フラグの述語メソッド。

Returns:

  • (Boolean)


32
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 32

def in_catalog? = in_catalog

#valid?Boolean

valid フラグの述語メソッド。

Returns:

  • (Boolean)


29
# File 'lib/vivlio/starter/cli/token_resolver.rb', line 29

def valid? = valid