Class: Fus::SwiftClass
- Inherits:
-
Object
- Object
- Fus::SwiftClass
- Defined in:
- lib/fus/swift_class.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ SwiftClass
constructor
A new instance of SwiftClass.
- #matches_classname?(path) ⇒ Boolean
- #spec? ⇒ Boolean
- #used_in_obj_c?(text) ⇒ Boolean
- #used_in_swift?(text) ⇒ Boolean
- #used_in_xml?(xml) ⇒ Boolean
Constructor Details
#initialize(name) ⇒ SwiftClass
Returns a new instance of SwiftClass.
4 5 6 |
# File 'lib/fus/swift_class.rb', line 4 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/fus/swift_class.rb', line 3 def name @name end |
Instance Method Details
#matches_classname?(path) ⇒ Boolean
12 13 14 |
# File 'lib/fus/swift_class.rb', line 12 def matches_classname?(path) path.match(/#{name}\b/) end |
#spec? ⇒ Boolean
8 9 10 |
# File 'lib/fus/swift_class.rb', line 8 def spec? name.match(/Spec/) end |
#used_in_obj_c?(text) ⇒ Boolean
20 21 22 |
# File 'lib/fus/swift_class.rb', line 20 def used_in_obj_c?(text) text.match(/(^|[^@])#{name}/) end |
#used_in_swift?(text) ⇒ Boolean
24 25 26 |
# File 'lib/fus/swift_class.rb', line 24 def used_in_swift?(text) text.match(/(\b#{name}.?[.:(])|([:].?#{name})|(typealias\s+.*=.+#{name})/) end |
#used_in_xml?(xml) ⇒ Boolean
16 17 18 |
# File 'lib/fus/swift_class.rb', line 16 def used_in_xml?(xml) xml.include?("customClass=\"#{name}\"") end |