Class: Ars::Familiar::Scribe::Entry
- Inherits:
-
String
- Object
- String
- Ars::Familiar::Scribe::Entry
- Defined in:
- lib/ars/familiar/scribe.rb
Instance Method Summary collapse
-
#initialize(string) ⇒ Entry
constructor
A new instance of Entry.
- #to_class ⇒ Object
- #to_filename ⇒ Object
Constructor Details
#initialize(string) ⇒ Entry
Returns a new instance of Entry.
9 10 11 |
# File 'lib/ars/familiar/scribe.rb', line 9 def initialize(string) super(string.to_s) end |
Instance Method Details
#to_class ⇒ Object
24 25 26 |
# File 'lib/ars/familiar/scribe.rb', line 24 def to_class self.respond_to?(:name) ? self : self.constantize end |
#to_filename ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ars/familiar/scribe.rb', line 13 def to_filename string = self.dup string.gsub!(/::/, '/') string.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') string.gsub!(/([a-z\d])([A-Z])/,'\1_\2') string.tr!("-", "_") string.downcase! string << '.dump' string end |