lib/moxml/processing_instruction.rb in moxml-0.1.0 vs lib/moxml/processing_instruction.rb in moxml-0.1.1
- old
+ new
@@ -1,44 +1,25 @@
+# frozen_string_literal: true
+
module Moxml
class ProcessingInstruction < Node
- def initialize(target_or_native = nil, content = nil)
- case target_or_native
- when String
- super(adapter.create_processing_instruction(nil, target_or_native, content))
- else
- super(target_or_native)
- end
- end
-
def target
- adapter.processing_instruction_target(native)
+ adapter.processing_instruction_target(@native)
end
def target=(new_target)
- adapter.set_processing_instruction_target(native, new_target)
- self
+ adapter.set_node_name(@native, new_target.to_s)
end
def content
- adapter.processing_instruction_content(native)
+ adapter.processing_instruction_content(@native)
end
def content=(new_content)
- adapter.set_processing_instruction_content(native, new_content)
- self
+ adapter.set_processing_instruction_content(@native, new_content.to_s)
end
- def blank?
- content.strip.empty?
- end
-
def processing_instruction?
true
- end
-
- private
-
- def create_native_node
- adapter.create_processing_instruction(nil, "", "")
end
end
end