Class: TMBundle::Action
- Inherits:
-
Object
- Object
- TMBundle::Action
- Defined in:
- lib/tm_bundle.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #expected_path ⇒ Object
-
#initialize(path) ⇒ Action
constructor
A new instance of Action.
- #inspect ⇒ Object
- #method_missing(meth, *args, &blk) ⇒ Object
- #unmatching_path? ⇒ Boolean
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/tm_bundle.rb', line 32 def method_missing(meth, *args, &blk) meth_name = meth.to_s if @data.key?(meth_name) @data[meth_name] else super end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
14 15 16 |
# File 'lib/tm_bundle.rb', line 14 def data @data end |
#path ⇒ Object
Returns the value of attribute path.
14 15 16 |
# File 'lib/tm_bundle.rb', line 14 def path @path end |
Instance Method Details
#expected_path ⇒ Object
24 25 26 |
# File 'lib/tm_bundle.rb', line 24 def expected_path @expected_path ||= data['name'].gsub(/[.:\/]+/, '.' => '_', ':' => '', '/' => '') + path.extname end |
#inspect ⇒ Object
20 21 22 |
# File 'lib/tm_bundle.rb', line 20 def inspect "#{self.class.name}:> #{data['name']} > `#{path.basename}`" end |
#unmatching_path? ⇒ Boolean
28 29 30 |
# File 'lib/tm_bundle.rb', line 28 def unmatching_path? expected_path != path.basename.to_s end |