Class: Flex::Template::Tag
- Inherits:
-
Object
- Object
- Flex::Template::Tag
- Defined in:
- lib/flex/template/tags.rb
Constant Summary collapse
- RESERVED =
[:context, :path, :data, :params, :no_pruning, :raw_result, :raise]
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#optional ⇒ Object
readonly
Returns the value of attribute optional.
Instance Method Summary collapse
-
#initialize(name, default) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(name, default) ⇒ Tag
Returns a new instance of Tag.
45 46 47 48 49 50 51 |
# File 'lib/flex/template/tags.rb', line 45 def initialize(name, default) raise SourceError, ":#{name} is a reserved symbol and cannot be used as a tag name" \ if RESERVED.include?(name) @name = name.to_sym @optional = !!default @default = YAML.load(default) unless default.nil? end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
43 44 45 |
# File 'lib/flex/template/tags.rb', line 43 def default @default end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
43 44 45 |
# File 'lib/flex/template/tags.rb', line 43 def name @name end |
#optional ⇒ Object (readonly)
Returns the value of attribute optional.
43 44 45 |
# File 'lib/flex/template/tags.rb', line 43 def optional @optional end |