Class: Props::Fragment
- Inherits:
-
Object
- Object
- Props::Fragment
- Defined in:
- lib/props_template/extensions/fragment.rb
Instance Attribute Summary collapse
-
#fragments ⇒ Object
readonly
Returns the value of attribute fragments.
Instance Method Summary collapse
- #handle(options) ⇒ Object
-
#initialize(base, fragments = []) ⇒ Fragment
constructor
A new instance of Fragment.
Constructor Details
#initialize(base, fragments = []) ⇒ Fragment
Returns a new instance of Fragment.
5 6 7 8 |
# File 'lib/props_template/extensions/fragment.rb', line 5 def initialize(base, fragments = []) @base = base @fragments = fragments end |
Instance Attribute Details
#fragments ⇒ Object (readonly)
Returns the value of attribute fragments.
3 4 5 |
# File 'lib/props_template/extensions/fragment.rb', line 3 def fragments @fragments end |
Instance Method Details
#handle(options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/props_template/extensions/fragment.rb', line 10 def handle() return if ![:partial] partial_name, partial_opts = [:partial] fragment = partial_opts[:fragment] if String === fragment || Symbol === fragment fragment_name = fragment.to_s path = @base.traveled_path.join(".") @name = fragment_name @fragments.push( {type: fragment_name, partial: partial_name, path: path} ) end end |