Class: ActiveFacts::Metamodel::Verbaliser::Player
- Inherits:
-
Object
- Object
- ActiveFacts::Metamodel::Verbaliser::Player
- Defined in:
- lib/activefacts/vocabulary/verbaliser.rb
Instance Attribute Summary collapse
-
#concept ⇒ Object
Returns the value of attribute concept.
-
#join_nodes_by_join ⇒ Object
Returns the value of attribute join_nodes_by_join.
-
#join_roles ⇒ Object
Returns the value of attribute join_roles.
-
#role_refs ⇒ Object
Returns the value of attribute role_refs.
-
#subscript ⇒ Object
Returns the value of attribute subscript.
Instance Method Summary collapse
- #describe ⇒ Object
-
#initialize(concept) ⇒ Player
constructor
A new instance of Player.
-
#role_adjuncts ⇒ Object
What words are used (across all roles) for disambiguating the references to this player? If more than one set of adjectives was used, this player must have been subject to loose binding.
Constructor Details
#initialize(concept) ⇒ Player
Returns a new instance of Player.
103 104 105 106 107 108 109 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 103 def initialize concept @concept = concept @join_nodes_by_join = {} @subscript = nil @join_roles = [] @role_refs = [] end |
Instance Attribute Details
#concept ⇒ Object
Returns the value of attribute concept.
102 103 104 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 102 def concept @concept end |
#join_nodes_by_join ⇒ Object
Returns the value of attribute join_nodes_by_join.
102 103 104 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 102 def join_nodes_by_join @join_nodes_by_join end |
#join_roles ⇒ Object
Returns the value of attribute join_roles.
102 103 104 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 102 def join_roles @join_roles end |
#role_refs ⇒ Object
Returns the value of attribute role_refs.
102 103 104 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 102 def role_refs @role_refs end |
#subscript ⇒ Object
Returns the value of attribute subscript.
102 103 104 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 102 def subscript @subscript end |
Instance Method Details
#describe ⇒ Object
124 125 126 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 124 def describe @concept.name + (@join_nodes_by_join.size > 0 ? " (in #{@join_nodes_by_join.size} joins)" : "") end |
#role_adjuncts ⇒ Object
What words are used (across all roles) for disambiguating the references to this player? If more than one set of adjectives was used, this player must have been subject to loose binding. This method is used to decide when subscripts aren’t needed.
114 115 116 117 118 119 120 121 122 |
# File 'lib/activefacts/vocabulary/verbaliser.rb', line 114 def role_adjuncts adjuncts = @role_refs.map{|rr| [ rr.leading_adjective, # rr.role.role_name, rr.trailing_adjective ].compact}.uniq.sort adjuncts.flatten*"_" end |