Class: Logaling::FileBasedProject

Inherits:
Project
  • Object
show all
Defined in:
lib/logaling/project.rb

Direct Known Subclasses

ImportedProject, PersonalProject

Instance Attribute Summary

Attributes inherited from Project

#path, #repository

Instance Method Summary collapse

Methods inherited from Project

find_dotfile, find_path, #glossaries, #glossary, #glossary_db_path, #imported?, #initialize, #personal?, #relative_path, #same?, #type

Constructor Details

This class inherits a constructor from Logaling::Project

Instance Method Details

#absolute_pathObject Also known as: glossary_source_path



140
141
142
# File 'lib/logaling/project.rb', line 140

def absolute_path
  @repository.expand_path(@path)
end

#bilingualr_pairObject



126
127
128
# File 'lib/logaling/project.rb', line 126

def bilingualr_pair
  File.basename(@path).split(/\./)[1, 2]
end

#glossary_sourcesObject



130
131
132
133
# File 'lib/logaling/project.rb', line 130

def glossary_sources
  source_language, target_language = bilingualr_pair
  [GlossarySource.create(@path, glossary(source_language, target_language))]
end

#has_glossary?(source_language, target_language) ⇒ Boolean

Returns:

  • (Boolean)


135
136
137
138
# File 'lib/logaling/project.rb', line 135

def has_glossary?(source_language, target_language)
  glossary_source_language, glossary_target_language = bilingualr_pair
  glossary_source_language == source_language && glossary_target_language == target_language
end

#nameObject



122
123
124
# File 'lib/logaling/project.rb', line 122

def name
  File.basename(@path).split(/\./).first
end

#normal_project?Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/logaling/project.rb', line 145

def normal_project?
  false
end

#source_directory_pathObject



149
150
151
# File 'lib/logaling/project.rb', line 149

def source_directory_path
  File.dirname(glossary_source_path)
end