class Flounder::EntityAlias
Alias for an Entity
, implementing roughly the same interface.
@see Entity
Attributes
entity[R]
Entity
this alias refers to
name[R]
Plural name of the alias
plural[R]
Plural name of the alias
singular[R]
Singular name of the alias
Public Class Methods
new(entity, plural, singular)
click to toggle source
# File lib/flounder/entity_alias.rb, line 8 def initialize entity, plural, singular @entity = entity @plural = plural @singular = singular end
Public Instance Methods
[](name)
click to toggle source
# File lib/flounder/entity_alias.rb, line 49 def [] name Field.new(self, name, table[name]) end
column_names()
click to toggle source
# File lib/flounder/entity_alias.rb, line 31 def column_names entity.column_names end
fields(*a)
click to toggle source
# File lib/flounder/entity_alias.rb, line 39 def fields *a a.map { |n| self[n] } end
inspect()
click to toggle source
# File lib/flounder/entity_alias.rb, line 43 def inspect "<Flounder/Entity/Alias #{entity.name}(#{entity.table_name}) as (#{plural}, #{singular}))>" end
Also aliased as: to_s
relations(*a)
click to toggle source
# File lib/flounder/entity_alias.rb, line 35 def relations *a entity.relations *a end
table()
click to toggle source
# File lib/flounder/entity_alias.rb, line 26 def table table = entity.table table.alias(plural) end