Class: ExtractI18n::Adapters::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/extract_i18n/adapters/adapter.rb

Direct Known Subclasses

RubyAdapter, SlimAdapter, SlimAdapterWip

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_key:, on_ask:, options: {}) ⇒ Adapter

Returns a new instance of Adapter.



15
16
17
18
19
# File 'lib/extract_i18n/adapters/adapter.rb', line 15

def initialize(file_key:, on_ask:, options: {})
  @on_ask = on_ask
  @file_key = file_key
  @options = options
end

Instance Attribute Details

#file_keyObject (readonly)

Returns the value of attribute file_key.



13
14
15
# File 'lib/extract_i18n/adapters/adapter.rb', line 13

def file_key
  @file_key
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



13
14
15
# File 'lib/extract_i18n/adapters/adapter.rb', line 13

def file_path
  @file_path
end

#on_askObject (readonly)

Returns the value of attribute on_ask.



13
14
15
# File 'lib/extract_i18n/adapters/adapter.rb', line 13

def on_ask
  @on_ask
end

#optionsObject (readonly)

Returns the value of attribute options.



13
14
15
# File 'lib/extract_i18n/adapters/adapter.rb', line 13

def options
  @options
end

Class Method Details

.for(file_path) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/extract_i18n/adapters/adapter.rb', line 5

def self.for(file_path)
  case file_path
  when /\.rb$/ then RubyAdapter
  when /\.slim$/ then SlimAdapter
  when /\.vue$/ then VueAdapter
  end
end

.supports_relative_keys?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/extract_i18n/adapters/adapter.rb', line 25

def self.supports_relative_keys?
  false
end

Instance Method Details

#run(content) ⇒ Object

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/extract_i18n/adapters/adapter.rb', line 21

def run(content)
  raise NotImplementedError
end