Class: FeduxOrgStdlib::Project::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/fedux_org_stdlib/project/plan.rb

Instance Method Summary collapse

Constructor Details

#initialize(main_file: File.join(Dir.getwd, 'plan.tjp'), additional_files: []) ⇒ Plan

Create a new project plan

Parameters:

  • main_file (String) (defaults to: File.join(Dir.getwd, 'plan.tjp'))

    The main project file

  • additional_files (Array) (defaults to: [])

    Additional files containing information about project plan



19
20
21
22
23
24
25
# File 'lib/fedux_org_stdlib/project/plan.rb', line 19

def initialize(
  main_file: File.join(Dir.getwd, 'plan.tjp'),
  additional_files: []
)
  @main_file        = main_file
  @additional_files = Array(additional_files)
end

Instance Method Details

#needs_to_be_compiled?(base_file) ⇒ true, false

Does the plan needs to be compiled

Parameters:

  • base_file (String)

    The output file which should be used to determine if the report is older then the project plan

Returns:

  • (true, false)

    Result of comparism



34
35
36
# File 'lib/fedux_org_stdlib/project/plan.rb', line 34

def needs_to_be_compiled?(base_file)
  (Array(main_file) + additional_files).any? { |f| File.mtime(f) > File.mtime(base_file) }
end

#to_sString

Output a textual representation of self

Returns:

  • (String)

    The path to the main file of the project plan



42
43
44
# File 'lib/fedux_org_stdlib/project/plan.rb', line 42

def to_s
  main_file
end