module DTK::DSL::Template::V1::ComponentLink::ImplicitLinkName
Public Class Methods
implicit_link_name(dependent_component_ref)
click to toggle source
# File lib/dsl/template/v1/component_link/implicit_link_name.rb, line 40 def self.implicit_link_name(dependent_component_ref) # This should not return nil, but allowing it to be more robust parse(dependent_component_ref, donot_raise_error: true) end
parse(dependent_component_ref, opts = {})
click to toggle source
opts can have keys:
:parent :donot_raise_error
# File lib/dsl/template/v1/component_link/implicit_link_name.rb, line 24 def self.parse(dependent_component_ref, opts = {}) last_component = dependent_component_ref.split('/').last # remove title if it exists title_split = last_component.split('[') case title_split.size when 1 return last_component when 2 return title_split[0] if title_split[1] =~ /\]$/ end unless opts[:donot_raise_error] raise opts[:parent].parsing_error("The term '#{dependent_component_ref}' is an ill-formed component link dependency reference") end nil end