class Extract::StringValue

Public Instance Methods

value() click to toggle source
# File lib/src/extract/string_value.rb, line 3
def value
  path = node[:props][:path]
  return formatted_array_values(path) if path.is_a?(Array)

  extract_value(node)
end

Private Instance Methods

extract_value(node_to_extract) click to toggle source
# File lib/src/extract/string_value.rb, line 12
def extract_value(node_to_extract)
  extractor.extract(node_to_extract)
end
formatted_array_values(paths) click to toggle source
# File lib/src/extract/string_value.rb, line 16
def formatted_array_values(paths)
  extractor.format_value(values_from_array(paths), node[:props])
end
values_from_array(paths) click to toggle source
# File lib/src/extract/string_value.rb, line 20
def values_from_array(paths)
  node_path = node.path

  paths.map do |inner|
    if inner.is_a?(String)
      extract_value(Node.new({ path: inner, link: node[:props][:link] }, node_path))
    else
      StringValue.new(Node.new(inner, node_path), extractor).value
    end
  end
end