module OoxmlParser::OoxmlObjectAttributeHelper

Module for stroing some attribute helpers for objects

Public Instance Methods

attribute_enabled?(node, attribute_name = 'val') click to toggle source

@param node [Nokogiri::XML:Element] node to parse @param attribute_name [String] name of attribute @return [True, False] is attribute enabled

# File lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb, line 22
def attribute_enabled?(node, attribute_name = 'val')
  return true if node.to_s == '1'
  return false if node.to_s == '0'
  return false if node.attribute(attribute_name).nil?

  status = node.attribute(attribute_name).value
  %w[true on 1].include?(status)
end
option_enabled?(node, attribute_name = 'val') click to toggle source

@param node [Nokogiri::XML:Element] node to parse @param attribute_name [String] name of attribute @return [True, False] is option enabled

# File lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb, line 9
def option_enabled?(node, attribute_name = 'val')
  return true if node.attributes.empty?
  return true if node.to_s == '1'
  return false if node.to_s == '0'
  return false if node.attribute(attribute_name).nil?

  status = node.attribute(attribute_name).value
  !%w[false off 0].include?(status)
end