Skip to content

Commit

Permalink
refactored the BlockDsl to be able to define keywords more easily
Browse files Browse the repository at this point in the history
  • Loading branch information
etorreborre committed Jul 6, 2018
1 parent e728f8d commit c9815ec
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ trait BlockDsl extends BlockCreation {
def can(f: => Fragment): Fragment = addBlock(s"$d can", f, addFragmentBlock)

def >>(fs: => Fragments)(implicit p1: ImplicitParam1): Fragments =
Use.ignoring(p1) { addBlock(d, fs, addFragmentsBlock) }
Use.ignoring(p1)(keyword(d, fs))

def should(fs: => Fragments)(implicit p1: ImplicitParam1): Fragments =
Use.ignoring(p1) { addBlock(s"$d should", fs, addFragmentsBlock) }
Use.ignoring(p1)(keyword(s"$d should", fs))

def can(fs: => Fragments)(implicit p1: ImplicitParam1): Fragments =
Use.ignoring(p1) { addBlock(s"$d can", fs, addFragmentsBlock) }
Use.ignoring(p1)(keyword(s"$d can", fs))
}

def keyword(text: String, fs: =>Fragments): Fragments =
addBlock(text, fs, addFragmentsBlock)


/**
* adding a conflicting implicit to warn the user when a `>>` was forgotten
*/
Expand Down

0 comments on commit c9815ec

Please sign in to comment.