Class: Tramway::Configs::Entity

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/tramway/configs/entity.rb

Overview

Tramway is an entity-based framework

Defined Under Namespace

Classes: HumanNameStruct, RouteStruct

Instance Method Summary collapse

Instance Method Details

#human_nameObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/tramway/configs/entity.rb', line 24

def human_name
  single, plural = if model_class.present?
                     model_name = model_class.model_name.human
                     [model_name, pluralized(model_name)]
                   else
                     [name.capitalize, name.pluralize.capitalize]
                   end

  HumanNameStruct.new(single, plural)
end

#page(name) ⇒ Object Also known as: set_page?



35
36
37
# File 'lib/tramway/configs/entity.rb', line 35

def page(name)
  pages.find { |page| page.action == name.to_s }
end

#routesObject



20
21
22
# File 'lib/tramway/configs/entity.rb', line 20

def routes
  RouteStruct.new(route_helper_method)
end