Module: ForemanNetbox::UserUsergroupCommonExtensions

Defined in:
app/models/concerns/foreman_netbox/user_usergroup_common_extensions.rb

Constant Summary collapse

NETBOX_TENANT_MAX_LENGTH =
100

Instance Method Summary collapse

Instance Method Details

#netbox_tenant_nameObject



7
8
9
10
11
12
# File 'app/models/concerns/foreman_netbox/user_usergroup_common_extensions.rb', line 7

def netbox_tenant_name
  return name unless name.length > NETBOX_TENANT_MAX_LENGTH

  name_length = NETBOX_TENANT_MAX_LENGTH - id.to_s.length - 1
  "#{name.to_s.truncate(name_length, omission: '')}-#{id}"
end

#netbox_tenant_slugObject



14
15
16
# File 'app/models/concerns/foreman_netbox/user_usergroup_common_extensions.rb', line 14

def netbox_tenant_slug
  netbox_tenant_name&.parameterize
end