Class: I18nFlow::YamlAstProxy::Sequence

Inherits:
Node
  • Object
show all
Defined in:
lib/i18n_flow/yaml_ast_proxy/sequence.rb

Constant Summary

Constants inherited from Node

Node::TAG_IGNORE, Node::TAG_ONLY, Node::TAG_TODO

Instance Attribute Summary

Attributes inherited from Node

#file_path, #ignored_violation, #node, #parent, #scopes

Instance Method Summary collapse

Methods inherited from Node

#==, #batch, #clone, #get, #initialize, #set, #to_yaml, #value

Methods included from NodeMetaData

#alias?, #anchor, #end_column, #end_line, #full_key, #has_anchor?, #key, #locale, #mapping?, #marked_as_only?, #marked_as_todo?, #num_lines, #scalar?, #sequence?, #start_column, #start_line, #todo_locales, #valid_locale?, #valid_locales

Constructor Details

This class inherits a constructor from I18nFlow::YamlAstProxy::Node

Instance Method Details

#eachObject



7
8
9
10
11
# File 'lib/i18n_flow/yaml_ast_proxy/sequence.rb', line 7

def each
  indexed_object.each.with_index do |o, i|
    yield i, wrap(o, key: i)
  end
end

#keysObject



19
20
21
# File 'lib/i18n_flow/yaml_ast_proxy/sequence.rb', line 19

def keys
  (0...size).to_a
end

#merge!(other) ⇒ Object



13
14
15
16
17
# File 'lib/i18n_flow/yaml_ast_proxy/sequence.rb', line 13

def merge!(other)
  return unless other&.is_a?(Sequence)

  indexed_object.concat(other.send(:indexed_object))
end