Skip to content

Commit

Permalink
changed raises to triggers hyper-operation rename in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
catmando committed Nov 6, 2018
1 parent e76c561 commit 873f4f4
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 565 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class DisplayTicker < HyperComponent
param :symbol
raises :cancel
param :symbol
triggers :cancel
before_mount { @ticker = StockTicker.new(@Symbol, 10.seconds) }

def status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def collect_other_params_as(name)
alias other_params collect_other_params_as
alias others collect_other_params_as

def raises(name, opts = {})
def triggers(name, opts = {})
aka = opts[:alias] || "#{name}!"
name = name =~ /^<(.+)>$/ ? name.gsub(/^<(.+)>$/, '\1') : "on_#{name}"
validator.event(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def optional(name, options = {})
end

def event(name)
rules[name] = coerce_native_hash_values(default: nil, type: Proc)
rules[name] = coerce_native_hash_values(default: nil, type: Proc, allow_nil: true)
end

def all_other_params(name)
Expand Down
8 changes: 4 additions & 4 deletions ruby/hyper-component/spec/client_features/element_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def render
it 'will subscribe to a component event param' do
evaluate_ruby do
class Foo < HyperComponent
raises :event
triggers :event
def render
event!
end
Expand All @@ -50,8 +50,8 @@ def render
it 'will subscribe to multiple component event params' do
evaluate_ruby do
class Foo < HyperComponent
raises :event1
raises :event2
triggers :event1
triggers :event2
def render
event1! + event2!
end
Expand Down Expand Up @@ -87,7 +87,7 @@ class Foo < HyperComponent

evaluate_ruby do
class Foo < HyperComponent
raises '<my_event>', alias: :my_event!
triggers '<my_event>', alias: :my_event!
def render
my_event!
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require 'spec_helper'

describe 'event callbacks', js: true do
it 'the raises macro will create an event method' do
it 'the triggers macro will create an event method' do
mount 'FooBar' do
class Foo
include Hyperstack::Component
raises :foo_bar
triggers :foo_bar
after_mount { foo_bar! }
render { 'render' }
end
Expand All @@ -28,7 +28,7 @@ class FooBar
mount 'Foo' do
class Foo
include Hyperstack::Component
raises :foo_bar
triggers :foo_bar
after_mount { foo_bar! }
render { 'render' }
end
Expand All @@ -40,7 +40,7 @@ class Foo
mount 'FooBar' do
class Foo
include Hyperstack::Component
raises :foo_bar, alias: :foo_bar
triggers :foo_bar, alias: :foo_bar
after_mount { foo_bar } # notice no !
render { 'render' }
end
Expand All @@ -63,7 +63,7 @@ class FooBar
mount 'FooBar' do
class Foo
include Hyperstack::Component
raises '<FooBar>', alias: :foo_bar!
triggers '<FooBar>', alias: :foo_bar!
after_mount { foo_bar! }
render { 'render' }
end
Expand Down
164 changes: 0 additions & 164 deletions ruby/hyper-operation/lib/hyper-operation/api.rb

This file was deleted.

13 changes: 0 additions & 13 deletions ruby/hyper-operation/lib/hyper-operation/exception.rb

This file was deleted.

33 changes: 0 additions & 33 deletions ruby/hyper-operation/lib/hyper-operation/railway/dispatcher.rb

This file was deleted.

0 comments on commit 873f4f4

Please sign in to comment.