Class: I18nYamlEditor::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_yaml_editor/category.rb

Overview

This is a category

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Category

Returns a new instance of Category.



10
11
12
13
# File 'lib/i18n_yaml_editor/category.rb', line 10

def initialize(attributes = {})
  @name = attributes[:name]
  @keys = Set.new
end

Instance Attribute Details

#keysObject

Returns the value of attribute keys.



8
9
10
# File 'lib/i18n_yaml_editor/category.rb', line 8

def keys
  @keys
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/i18n_yaml_editor/category.rb', line 8

def name
  @name
end

Instance Method Details

#add_key(key) ⇒ Object

Adds a given key to this category’s list of keys

Parameters:

  • key (Key)

    key to be added to this category’s list of keys



17
18
19
# File 'lib/i18n_yaml_editor/category.rb', line 17

def add_key(key)
  keys.add(key)
end

#complete?true, false

Checks and returns if all keys are complete

Returns:

  • (true, false)


23
24
25
# File 'lib/i18n_yaml_editor/category.rb', line 23

def complete?
  keys.all?(&:complete?)
end