summaryrefslogtreecommitdiff
path: root/lib/AnonymousCommand.cs
blob: 632e4a5b5db553931def89f968b98851d4624573 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Linq.Expressions;

namespace jive
{
  public class AnonymousCommand : Command
  {
    readonly Action action;

    public AnonymousCommand(Expression<Action> action) : this(action.Compile()) {}

    public AnonymousCommand(Action action)
    {
      this.action = action;
    }

    public void run()
    {
      action();
    }
  }
}