class Enolib::Element
Public Instance Methods
to_document()
click to toggle source
# File lib/enolib/elements/element.rb, line 5 def to_document unless @instruction[:type] == :document raise Errors::Validation.unexpected_element_type(@context, nil, @instruction, 'expected_document') end unless instance_variable_defined?(:@section) @section = Section.new(@context, @instruction) @yielded = :section end @section end
to_fieldset_entry()
click to toggle source
# File lib/enolib/elements/element.rb, line 18 def to_fieldset_entry unless instance_variable_defined?(:@fieldset_entry) unless @instruction[:type] == :fieldset_entry # TODO: Below and in all implementations - why nil for key as second parameter? raise Errors::Validation.unexpected_element_type(@context, nil, @instruction, 'expected_fieldset_entry') end @fieldset_entry = FieldsetEntry.new(@context, @instruction) end @fieldset_entry end
to_list_item()
click to toggle source
# File lib/enolib/elements/element.rb, line 31 def to_list_item unless instance_variable_defined?(:@list_item) unless @instruction[:type] == :list_item raise Errors::Validation.unexpected_element_type(@context, nil, @instruction, 'expected_list_item') end @list_item = FieldsetEntry.new(@context, @instruction) end @list_item end
to_s()
click to toggle source
# File lib/enolib/elements/element.rb, line 43 def to_s "#<Enolib::Element key=#{_key} yields=#{_yields}>" end
to_section()
click to toggle source
# File lib/enolib/elements/element.rb, line 47 def to_section unless instance_variable_defined?(:@section) unless @instruction[:type] == :section || @instruction[:type] == :document raise Errors::Validation.unexpected_element_type(@context, nil, @instruction, 'expected_section') end @section = Section.new(@context, @instruction) @yielded = :section end @section end
yields_fieldset_entry?()
click to toggle source
# File lib/enolib/elements/element.rb, line 60 def yields_fieldset_entry? @instruction[:type] == :fieldset_entry end
yields_list_item?()
click to toggle source
# File lib/enolib/elements/element.rb, line 64 def yields_list_item? @instruction[:type] == :list_item end
yields_section?()
click to toggle source
# File lib/enolib/elements/element.rb, line 68 def yields_section? @instruction[:type] == :section || @instruction[:type] == :document end