Question: I’m using Rails 4.2.7 with Nokogiri. How do I create a new Nokogiri node to add to my document? I thought I could do this

```
general = doc.xpath("//lomimscc:general")
title = Nokogiri::XML::Node.new "lomimscc:title"
string = Nokogiri::XML::Node.new "lomimscc:string"
string.content = scenario.title
string.language = 'en' 
title << string 
general << title 

```

but I’m getting the error

```
ArgumentError: wrong number of arguments (given 1, expected 2+)
    from /Users/davea/Documents/workspace/sims/app/helpers/myproject_helper.rb:73:in `new'
    from /Users/davea/Documents/workspace/sims/app/helpers/myproject_helper.rb:73:in `set_manifest_title'
    from /Users/davea/Documents/workspace/sims/app/helpers/myproject_helper.rb:59:in `generate_manifest_file

```

Answer: 
An interface describes the methods that must be implemented, but has no say in *how* they are implemented or what the implementation must actually do.

An abstract class, however, allows you to define behavior while still using abstract methods as points of extensibility. A combination of non-abstract public methods and abstract protected methods may do what you want:

```
public abstract class Sender
{
    public void Send()
    {
        ValidateContent();
        DoSend();
    }

    private void ValidateContent()
    {
        // Put validation code here
    }

    protected abstract void DoSend();
}

public class EmailReportSender : Sender
{
    protected override void DoSend()
    {
        // Do stuff
    }
}
public class IPhoneNotificationReportSender : Sender
{
    protected override void DoSend()
    {
        // Do stuff
    }
}

```
This sounds like a job for unit testing. Your compiler isn't going to enforce it for you, but if the rule exists, then it should be tested accordingly. The below uses Moq.

```
[TestFixture]
public class EmailReportSenderTests
{
    [Test]
    public void EmailReportSender_Send_CallsValidateContent()
    {
        var mock = new Mock<ISender>();
        mock.Setup(m => m.Send()).Verifiable();

        var sender = new EmailReportSender(mock.Object);
        sender.Send();

        mock.Verify(m => m.ValidateContent());
    }
}

```

I haven't tried that snippet, so it may have typos, but you get the idea.