Module: I18nFlow::YamlAstProxy::NodeMetaData
- Included in:
- Node
- Defined in:
- lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb
Instance Method Summary collapse
- #alias? ⇒ Boolean
- #anchor ⇒ Object
- #end_column ⇒ Object
- #end_line ⇒ Object
- #full_key ⇒ Object
- #has_anchor? ⇒ Boolean
- #key ⇒ Object
- #locale ⇒ Object
- #mapping? ⇒ Boolean
- #marked_as_only? ⇒ Boolean
- #marked_as_todo? ⇒ Boolean
- #num_lines ⇒ Object
- #scalar? ⇒ Boolean
- #sequence? ⇒ Boolean
- #start_column ⇒ Object
- #start_line ⇒ Object
- #todo_locales ⇒ Object
- #valid_locale? ⇒ Boolean
- #valid_locales ⇒ Object
Instance Method Details
#alias? ⇒ Boolean
52 53 54 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 52 def alias? node.is_a?(Psych::Nodes::Alias) end |
#anchor ⇒ Object
36 37 38 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 36 def anchor node.anchor end |
#end_column ⇒ Object
32 33 34 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 32 def end_column node.end_column end |
#end_line ⇒ Object
24 25 26 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 24 def end_line node.end_line + line_correction end |
#full_key ⇒ Object
16 17 18 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 16 def full_key scopes.join('.') end |
#has_anchor? ⇒ Boolean
56 57 58 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 56 def has_anchor? !!anchor end |
#key ⇒ Object
8 9 10 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 8 def key scopes.last end |
#locale ⇒ Object
12 13 14 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 12 def locale scopes.first end |
#mapping? ⇒ Boolean
44 45 46 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 44 def mapping? is_a?(Mapping) end |
#marked_as_only? ⇒ Boolean
64 65 66 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 64 def marked_as_only? @tag == :only end |
#marked_as_todo? ⇒ Boolean
60 61 62 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 60 def marked_as_todo? @tag == :todo end |
#num_lines ⇒ Object
3 4 5 6 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 3 def num_lines return 1 unless end_line end_line - start_line + 1 end |
#scalar? ⇒ Boolean
48 49 50 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 48 def scalar? node.is_a?(Psych::Nodes::Scalar) end |
#sequence? ⇒ Boolean
40 41 42 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 40 def sequence? is_a?(Sequence) end |
#start_column ⇒ Object
28 29 30 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 28 def start_column node.start_column end |
#start_line ⇒ Object
20 21 22 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 20 def start_line node.start_line + line_correction end |
#todo_locales ⇒ Object
68 69 70 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 68 def todo_locales @todo_locales ||= [] end |
#valid_locale? ⇒ Boolean
76 77 78 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 76 def valid_locale? valid_locales.empty? || valid_locales.include?(locale) end |
#valid_locales ⇒ Object
72 73 74 |
# File 'lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb', line 72 def valid_locales @valid_locales ||= [] end |