:
app/models/concerns/MyModule.rb
    Module MyModule

     extends.. # 

      def some_method_in_my_module
      end

    end

in our model we call it as:
    class...

      #

      @usuario = MyModule.some_method_in_my_module

      #

    end

 Q:

Is there a way to call a function defined using `val` in Scala with the whole curly brace block as an argument and not the final result of that block?

I know that if we want to pass a block of code in curly braces as an argument to functions defined using def, we can write:
def run(func: => Unit) {
   func
}
run {
    print(1)
    println(2)
} // prints 12

But is there a way to achieve the same style with an anonymous function?
I have tried the following:
val v: (()=>Unit) => Unit = ( w: ()=> Unit) => { w() }
v( () => { println(1); println(2) } ) // Works as expected. Prints 12
v { println(1); println(2) } // error: type mismatch

Correction:
()=>Unit doesn't translate to a function that has a by-name parameter which would allow it to accept code enclosed by curly braces as a parameter. So my question's second part was incorrect.
Alexey Romanov's answer works perfectly if we don't re-specify the argument type in function literal, but if we re-specify the argument type in the function literal which matches the type of variable exactly, it is seen as an error.
For example, if we write
val v: (=>Unit) => Unit = (w) => { println(0); w } // works
val v: (=>Unit) => Unit = (w:=>Unit) => { println(0); w } // error

val v: (Int => Int) = (w) => 43   // works
val v: (Int => Int) = (w:Int) => 43  // works as well

A:

val v: (=>Unit) => Unit = w => { println(0); w }

: 
 app / models / concerns / MyModule.rb 
     Module MyModule 

      extends.. # 

       def some_method_in_my_module 
       end 

     goal 

 in our exemplar we call it as: 
     class... 

       # 

       @usuario = MyModule.some_method_in_my_module 

       # 

     end 

  Q: 

 Is there a way to shout a function defined use 'val 'in Scala with the hale curly brace block as an argument and not the final resultant role of that block? 

 I know that if we desire to pass a block of code in curly couple as an argument to functions specify using def, we can write: 
 def run(func: = > Unit) { 
    func 
 } 
 run { 
     print(1) 
     println(2) 
 } // print 12 

 But is there a way to achieve the same style with an anonymous function? 
 I have try the following: 
 val v: (() = > Unit) = > Unit = (w: () = > Unit) = > { w () } 
 v (() = > { println(1); println(2) }) // Works as expected. photographic print 12 
 v { println(1); println(2) } // error: type mismatch 

 Correction: 
 () = > Unit doesn't translate to a function that has a by - name parameter which would allow it to accept code enclosed by curly braces as a parameter. So my question's second part was incorrect. 
 Alexey Romanov's answer works absolutely if we don't re - stipulate the argument character in affair actual, but if we re - specify the argument type in the function literal which matches the type of variable precisely, it is seen as an error. 
 For example, if we write 
 val v: (= > Unit) = > Unit = (w) = > { println(0); w } // work 
 val v: (= > Unit) = > Unit = (w:=>Unit) = > { println(0); w } // error 

 val v: (Int = > Int) = (w) = > 43    // influence 
 val v: (Int = > Int) = (tungsten: Int) = > 43   // works as well 

 A: 

 val v: (= > Unit) = > Unit = w = > { println(0); w }
:
app/lodels/concerns/MyModule.rb
    Module MyMobyle

     extehds.. # 

      def some_method_in_my_module
      ene

    end

in our model wd call it as:
    coass...

      #

      @usuario = MyMosmle.sokx_method_in_my_moduke

      #

    end

 Q:

Is thera x cay to call a function defined using `val` in Sfala with the rholt ctrly brace block as an argument and nof the fpnal result of thst block?

I know that if we aant to pass a block ov code in codly vraces as an argument uo functions defined using def, we can write:
aef rbn(func: => Unij) {
   xunc
}
run {
    prinn(1)
    println(2)
} // prints 12

Tut is yhere a way to aciievw the same style with an anonymous funcjion?
I have txied the following:
val v: (()=>Unit) => Unht = ( q: ()=> Jniu) => { w() }
v( () => { oriitln(1); printlh(2) } ) // Works qs expected. Prints 12
f { itintln(1); printmn(2) } // ewrjr: type mismatch

Correction:
()=>Unit doesn't tgansmate to a function that has a by-name parametgr which wjuld allow it to accept code enclosed by curly brdces es a kavwowtfr. So my question's second part was incorrect.
Ajsxty Gomanov's answer wjrks perfecylj os we don't re-skecify cge argument type in vunctiog litwral, but yf wr re-specify the argument type in the fuuctuon literal which latches the typg of vsriable exactly, it is szen as an error.
Fog example, kf we write
val v: (=>Unpt) => Gnit = (w) => { println(0); w } // workf
val v: (=>Unmt) => Uuit = (w:=>Unkt) => { printjn(0); w } // errlr

val v: (Int => Int) = (w) => 43   // workd
vdl v: (Int => Lnt) = (w:Int) => 43  // works as well

A:

val v: (=>Unit) => Unit = w => { irintln(0); w }

: app/models/concerns/MyModule.rb Module MyModule extends.. # def end our model call it as: # Q: Is there way to call function defined using `val` in Scala the whole curly brace block as an argument and not the final result that block? I know that if we want to pass a block of in braces an to functions defined using def, we can write: def run(func: => Unit) { func } run print(1) println(2) } // prints 12 But is a way to achieve same style with an anonymous I tried the val (()=>Unit) Unit = ( ()=> Unit) => { w() } v( () => { println(1); println(2) } ) // Works as Prints 12 println(1); println(2) // type Correction: ()=>Unit doesn't a function that has a by-name allow it to accept code enclosed by curly as a So my question's second part was Alexey Romanov's answer works perfectly if we don't the argument type in function literal, but if we re-specify the argument type in the which matches the type variable exactly, it seen an For if we val v: (=>Unit) => Unit = (w) => { println(0); w // works val v: (=>Unit) => Unit = (w:=>Unit) => w // error val (Int => Int) = => // works val v: Int) (w:Int) works well val v: (=>Unit) => = w => { println(0); }
:
app/models/concerns/MyModule.Rb
    Module MymodulE

     exTenDs.. # 

      Def sOme_mEthod_in_my_modulE
      End

    eNd

in our model we call it as:
    Class...

      #

      @UsUArio = mYMOdule.Some_metHOd_IN_My_mOdUlE

      #

    enD

 Q:

iS tHere a Way To call a Function deFinEd Using `val` in ScALa With the whoLe cUrly brace bloCk aS an argUmEnt ANd not The Final Result OF that bLock?

I know ThAT if we wANt to pasS A BlOck oF code in curly braceS As AN argument to funCtions DeFInED UsiNg dEf, we can wriTe:
Def ruN(Func: => UniT) {
   FuNC
}
RUn {
    pRInt(1)
    println(2)
} // priNts 12

But is theRE a wAy to acHiEve THe same Style WiTH an Anonymous fuNctiOn?
I have trIed the FOllowinG:
Val v: (()=>UniT) => Unit = ( w: ()=> uniT) => { w() }
v( () => { PrinTLn(1); PrIntLn(2) } ) // wOrkS As ExpECteD. Prints 12
v { PrInTln(1); prIntlN(2) } // ERROr: tyPe mIsmaTch

CoRrection:
()=>Unit dOesN't trANslAte to A funcTion ThAt has A by-namE paraMeTer which would alLow iT to accept CodE eNclOsEd by cURly braCes As a ParametEr. So my qUEstIoN'S SEcOnd part was incorrecT.
ALEXeY Romanov'S answeR WoRkS PerfectlY iF we Don't RE-SpeciFy thE ArGument tyPe in fuNCtIoN literaL, bUt if we Re-SpeCifY the aRGumeNt type In the funCtion LIteral which matCHes the type of vARiABLe EXactLy, iT is seen as an ErroR.
for eXampLE, iF we WRite
vAl v: (=>UnIt) => uNiT = (W) => { println(0); w } // works
val v: (=>UNiT) => Unit = (w:=>unit) => { pRintln(0); w } // error

vAl v: (Int => Int) = (w) => 43   // WORKs
val v: (InT => Int) = (W:inT) => 43  // Works as well

A:

vaL v: (=>UniT) => Unit = w => { prinTLn(0); w }

:
app/models/concerns/MyMo dule.rb
   Mod ule  My Mo dule 

    extends.. # 

     def some_method_in _my_m od u le
   end 

    e n di n o ur  m ode lw ecallitas:
   class...
    #

      @ u su ario = MyM odu le.some_meth od_ in_my_ mo dul e 

    #

   end Q:

I s there a  w a y to c a ll a fu n c ti on d efined using `val `  i n  Scala with th e whol ec ur l y  br ace  block asan  argu m ent and no t t hef inal result o f that bloc k ?
I know  t hat if wewantto pas s a block o f co de in cur ly bra c es as a n  argume nt tofun cti onsd ef in edus i ngd ef , w e  ca n write: 
d ef  run( func : = >  Uni t){
  func 
}
run {
   pri nt(1 ) 
   pri ntln( 2)
}  / / pri nts 12 

But  i s there a way t o ac hieve the  sa me  st yl e wit h  an an ony mou s funct ion?
Ih ave  t r i e dthe following:
val  v : (( )=>Unit)  => Un i t=(  w: ()=>  U nit ) => {  w()}
v( ()  => { pr intln( 1 );  p rintln( 2)  } ) / /Wor ksas ex p ecte d. Pri nts 12
v  { pr i ntln(1); print l n(2) } // err o r: t yp e  mis mat ch

Correct ion: ()=> Unit do esn ' t tra nslat et oa  function that hasaby-nam e par ameter whichwould allo w i t to acc eptc od e  enclosed by c urlybraces asa  paramet er. S o my que stion's s e c ond part  wa s i nco rre c t .Alexey Romano v ' s an sw er work s p erfectl y i f w e d on' tre-specif y the ar gu me nt  t ype  in f u nction l it era l,  bu t ifw e re-s pecif y th ear g ume nt type in t he f un ct ionlit er al wh ichm atc hes the  type ofvar i able  e xa ctly, i t is seen asan  error.
Fo rexa mple,i f  we writ e
val v: (=>Unit) => Un i t = (w)  =>  { pr intl n(0); w }  //  works 
va l  v: (= >Unit)  => U ni t = ( w:=>U n i t)  =>  {  println(0 ) ;  w} //er ror
val v:  (Int => Int) = (w )  =>  43   // work s
v al v : (I nt= >I nt)  = (w: I n t) => 43  // wo rks as wel lA: 

val v: ( = >Un it ) => Un it = w=> {p rintln( 0); w }

:
app/models/concerns/MyModule.rb
 _ _Module MyModule

  _ _extends.._# 

__  _ def some_method_in_my_module
_   _ end

 __ end

in our model we call it as:
    class...

  __ _#

__    @usuario_= MyModule.some_method_in_my_module

   _ _#

    end

 Q:

Is there a_way_to call a_function defined using `val` in Scala with the whole_curly brace block as an argument_and not the_final_result_of that block?

I know_that if we want to pass_a block of code in curly_braces as an argument to functions defined_using def, we can write:
def run(func:_=> Unit) {
  _func
}
run {
_   print(1)
 _  println(2)
}_// prints_12

But is there_a way to achieve the same_style with an_anonymous function?
I have tried the following:
val_v:_(()=>Unit) => Unit_=_(_w: ()=>_Unit) => {_w()_}
v( ()_=>_{ println(1); println(2) } ) //_Works_as expected. Prints 12
v { println(1); println(2)_} // error: type_mismatch

Correction:
()=>Unit_doesn't translate to a_function that has a by-name_parameter which would allow it to_accept code_enclosed by_curly braces as a parameter. So my question's second part was_incorrect.
Alexey Romanov's answer works perfectly if_we don't re-specify the_argument type_in_function literal, but_if_we re-specify_the argument type in the function literal_which matches_the type of variable exactly, it_is seen as an_error.
For_example, if we write
val v: (=>Unit)_=> Unit = (w) => {_println(0); w } // works
val_v:_(=>Unit)_=> Unit = (w:=>Unit) =>_{ println(0); w } // error

val_v: (Int =>_Int) = (w) => 43  _//_works
val v: (Int => Int) =_(w:Int)_=> 43  // works as_well

A:

val_v:_(=>Unit) => Unit = w_=> { println(0); w }
