Class: Termtter::Hook
- Inherits:
-
Object
- Object
- Termtter::Hook
- Defined in:
- lib/termtter/hook.rb
Instance Attribute Summary collapse
-
#exec_proc ⇒ Object
Returns the value of attribute exec_proc.
-
#name ⇒ Object
Returns the value of attribute name.
-
#points ⇒ Object
Returns the value of attribute points.
Instance Method Summary collapse
-
#initialize(args) ⇒ Hook
constructor
A new instance of Hook.
- #match?(point) ⇒ Boolean
Constructor Details
#initialize(args) ⇒ Hook
Returns a new instance of Hook.
7 8 9 10 11 12 |
# File 'lib/termtter/hook.rb', line 7 def initialize(args) raise ArgumentError, ":name is not given." unless args.has_key?(:name) @name = args[:name].to_sym @points = args[:points] ? args[:points].map {|i| i.to_sym } : [] @exec_proc = args[:exec_proc] || lambda {} end |
Instance Attribute Details
#exec_proc ⇒ Object
Returns the value of attribute exec_proc.
5 6 7 |
# File 'lib/termtter/hook.rb', line 5 def exec_proc @exec_proc end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/termtter/hook.rb', line 5 def name @name end |
#points ⇒ Object
Returns the value of attribute points.
5 6 7 |
# File 'lib/termtter/hook.rb', line 5 def points @points end |
Instance Method Details
#match?(point) ⇒ Boolean
14 15 16 |
# File 'lib/termtter/hook.rb', line 14 def match?(point) points.include?(point.to_sym) end |