Sha256: 5bddfa6d3fddd6b39774f64d7a03a67fba74b02b40b0f61566f027c8f1e9c24d

Contents?: true

Size: 820 Bytes

Versions: 33

Compression:

Stored size: 820 Bytes

Contents

<!-- Renders a human readable version of the type of the context

### Details

 - If `this` is already a class, the name of that class is used
 - Otherwise, first `this.member_class` (for collections), then `this.class` are tried
 - By default the name is titleised and singular.

### Attributes

 - plural: pluralise the name
 - lowercase: render the name in all lower case
 - dasherize: render the name in lower case with dashes instead of spaces.

-->
<def tag="type-name" attrs="plural, lowercase, dasherize"><%=
  type ||= (this if this.is_a?(Class)) || this.try.member_class || this.class

  name = type.respond_to?(:model_name) ? type.model_name.human : type.name
  name = dasherize ? name.underscore.dasherize : name.titleize
  name = name.pluralize if plural
  name = name.downcase if lowercase
  name
%></def>

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
hobo_rapid-2.2.6 taglibs/views/type_name.dryml
hobo_rapid-2.2.5 taglibs/views/type_name.dryml
hobo_rapid-2.2.4 taglibs/views/type_name.dryml
hobo_rapid-2.2.3 taglibs/views/type_name.dryml
hobo_rapid-2.2.2 taglibs/views/type_name.dryml
hobo_rapid-2.2.1 taglibs/views/type_name.dryml
hobo_rapid-2.2.0 taglibs/views/type_name.dryml
hobo_rapid-2.1.2 taglibs/views/type_name.dryml
hobo_rapid-2.1.1 taglibs/views/type_name.dryml
hobo_rapid-2.1.0 taglibs/views/type_name.dryml
hobo_rapid-2.1.0.pre4 taglibs/views/type_name.dryml
hobo_rapid-2.1.0.pre3 taglibs/views/type_name.dryml
hobo_rapid-2.1.0.pre2 taglibs/views/type_name.dryml
hobo_rapid-2.1.0.pre1 taglibs/views/type_name.dryml
hobo_rapid-2.0.1 taglibs/views/type_name.dryml
hobo_rapid-2.0.0 taglibs/views/type_name.dryml
hobo_rapid-2.0.0.pre10 taglibs/views/type_name.dryml
hobo_rapid-2.0.0.pre9 taglibs/views/type_name.dryml
hobo_rapid-2.0.0.pre8 taglibs/views/type_name.dryml
hobo_rapid-2.0.0.pre7 taglibs/views/type_name.dryml