Class: Token::Token
- Inherits:
-
Object
- Object
- Token::Token
- Defined in:
- lib/token/token.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Token
Returns a new instance of Token.
6 7 8 9 10 11 12 |
# File 'lib/token/token.rb', line 6 def initialize(args = {}) @name = args[:name] @types = args[:types] @children = args[:children] @content = args[:content] || "" end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
4 5 6 |
# File 'lib/token/token.rb', line 4 def children @children end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
4 5 6 |
# File 'lib/token/token.rb', line 4 def content @content end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/token/token.rb', line 4 def name @name end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
4 5 6 |
# File 'lib/token/token.rb', line 4 def types @types end |
Class Method Details
.process_options(options = {}) ⇒ Object
Note:
should only be performed once!!!
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/token/token.rb', line 15 def self.( = {}) # pushing defaults [:template] ||= :default [:html] = { :class => [:token].to_s }.merge([:html] || {}) [:area] ||= :body %w(handler token template html area).each do |opt| self.class_variable_set("@@#{opt}".to_sym, [opt.to_sym]) class_eval " def self.#{opt} return self.class_variable_get(:@@#{opt}) if self.class_variable_defined? :@@#{opt} end def #{opt} self.class.#{opt} end " end end |
Instance Method Details
#to_s ⇒ Object
41 42 43 |
# File 'lib/token/token.rb', line 41 def to_s self.class.class_variable_get(:@@token).to_s.capitalize end |