Class: Spellr::Language
- Inherits:
-
Object
- Object
- Spellr::Language
- Defined in:
- lib/spellr/language.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, key: name[0], includes: [], hashbangs: [], locale: []) ⇒ Language
constructor
A new instance of Language.
- #matches?(file) ⇒ Boolean
- #project_wordlist ⇒ Object
- #wordlists ⇒ Object
Constructor Details
#initialize(name, key: name[0], includes: [], hashbangs: [], locale: []) ⇒ Language
Returns a new instance of Language.
10 11 12 13 14 15 16 |
# File 'lib/spellr/language.rb', line 10 def initialize(name, key: name[0], includes: [], hashbangs: [], locale: []) @name = name @key = key @includes = includes @hashbangs = hashbangs @locales = Array(locale) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/spellr/language.rb', line 8 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/spellr/language.rb', line 7 def name @name end |
Instance Method Details
#matches?(file) ⇒ Boolean
18 19 20 |
# File 'lib/spellr/language.rb', line 18 def matches?(file) matches_includes?(file) || matches_hashbangs?(file) end |
#project_wordlist ⇒ Object
26 27 28 29 30 31 |
# File 'lib/spellr/language.rb', line 26 def project_wordlist @project_wordlist ||= Spellr::Wordlist.new( Pathname.pwd.join('.spellr_wordlists', "#{name}.txt"), name: name ) end |
#wordlists ⇒ Object
22 23 24 |
# File 'lib/spellr/language.rb', line 22 def wordlists default_wordlists.select(&:exist?) end |