Class: Gamefic::Element
Direct Known Subclasses
Entity
Constant Summary
Constants included
from Matchable
Matchable::SPLIT_REGEXP
Instance Attribute Summary
Attributes included from Describable
#definite_article, #indefinite_article, #name, #synonyms
#person
#plural
Class Method Summary
collapse
Instance Method Summary
collapse
default_description, default_description=, #definitely, #description, #description=, #has_description?, #indefinitely, #keywords, #proper_named=, #proper_named?, #to_s
Methods included from Matchable
#keywords, #match?
#plural?
Constructor Details
#initialize(args = {}) {|_self| ... } ⇒ Element
Returns a new instance of Element.
5
6
7
8
9
10
11
|
# File 'lib/gamefic/element.rb', line 5
def initialize(args = {})
self.class.default_attributes.merge(args).each { |key, value|
send "#{key}=", value
}
post_initialize
yield self if block_given?
end
|
Class Method Details
.default_attributes ⇒ Object
22
23
24
|
# File 'lib/gamefic/element.rb', line 22
def default_attributes
@default_attributes ||= {}
end
|
.inherited(subclass) ⇒ Object
26
27
28
|
# File 'lib/gamefic/element.rb', line 26
def inherited subclass
subclass.set_default default_attributes
end
|
.set_default(attrs = {}) ⇒ Object
18
19
20
|
# File 'lib/gamefic/element.rb', line 18
def set_default attrs = {}
default_attributes.merge! attrs
end
|
Instance Method Details
#post_initialize ⇒ Object
13
14
15
|
# File 'lib/gamefic/element.rb', line 13
def post_initialize
end
|