Class: Basis::My
- Inherits:
-
Object
- Object
- Basis::My
- Defined in:
- lib/basis/my.rb
Instance Attribute Summary collapse
-
#classname ⇒ Object
readonly
Returns the value of attribute classname.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#underpath ⇒ Object
readonly
Returns the value of attribute underpath.
Instance Method Summary collapse
-
#initialize(name) ⇒ My
constructor
A new instance of My.
- #to_h ⇒ Object
Constructor Details
#initialize(name) ⇒ My
Returns a new instance of My.
8 9 10 11 12 13 14 15 |
# File 'lib/basis/my.rb', line 8 def initialize name @name = name @path = @name.tr "-", "/" @underpath = @path.tr "/", "_" @classname = @name.split("-"). map { |a| a.split("_").map { |b| b.capitalize }.join }.join "::" end |
Instance Attribute Details
#classname ⇒ Object (readonly)
Returns the value of attribute classname.
3 4 5 |
# File 'lib/basis/my.rb', line 3 def classname @classname end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/basis/my.rb', line 4 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/basis/my.rb', line 5 def path @path end |
#underpath ⇒ Object (readonly)
Returns the value of attribute underpath.
6 7 8 |
# File 'lib/basis/my.rb', line 6 def underpath @underpath end |
Instance Method Details
#to_h ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/basis/my.rb', line 17 def to_h @hash ||= { "my.classname" => classname, "my.name" => name, "my.path" => path, "my.underpath" => underpath, } end |