Class: PolyglotFlutter::Serializer::Localization::Base

Inherits:
Object
  • Object
show all
Includes:
ERB::Util, Helper::General
Defined in:
lib/flutter_polyglot_cli/serializers/localizations/loc_serializer.rb

Constant Summary

Constants included from Helper::General

Helper::General::ESCAPE_KEYWORDS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::General

#clean_enum_name, #clean_variable_name, #config, #escape_keyword_if_needed, #escape_with_underscore_if_needed, #extract_translations, #generate_locales, #generate_localization_keys, #indent, #mandatory_language, #programming_language, #project_configs, #token, #use_old_naming

Constructor Details

#initialize(languages: nil, translation_keys: nil, mandatory_language: nil) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
# File 'lib/flutter_polyglot_cli/serializers/localizations/loc_serializer.rb', line 9

def initialize(languages: nil, translation_keys: nil, mandatory_language: nil)
  @languages = languages
  @translation_keys = translation_keys
  @mandatory_language = mandatory_language
end

Instance Attribute Details

#languagesObject

Returns the value of attribute languages.



7
8
9
# File 'lib/flutter_polyglot_cli/serializers/localizations/loc_serializer.rb', line 7

def languages
  @languages
end

#translation_keysObject

Returns the value of attribute translation_keys.



7
8
9
# File 'lib/flutter_polyglot_cli/serializers/localizations/loc_serializer.rb', line 7

def translation_keys
  @translation_keys
end

Instance Method Details

#renderObject



15
16
17
# File 'lib/flutter_polyglot_cli/serializers/localizations/loc_serializer.rb', line 15

def render
  ERB.new(template, nil, '-').result(binding)
end

#save(_path) ⇒ Object

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/flutter_polyglot_cli/serializers/localizations/loc_serializer.rb', line 23

def save(_path)
  raise NotImplementedError, 'Abstract Method'
end

#templateObject

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/flutter_polyglot_cli/serializers/localizations/loc_serializer.rb', line 19

def template
  raise NotImplementedError, 'Abstract Method'
end