모듈: Mongoid::Extensions::String
- 다음에 정의됨:
- lib/mongoid/extensions/string.rb
개요
string 클래스에 유형 캐스팅 동작을 추가합니다.
네임스페이스 아래에 정의됨
모듈: 클래스 메서드
인스턴스 속성 요약 접기
- #unconvertable_to_bson ⇒ 객체 사용 중단 더 이상 사용되지 않습니다.
- #unconvertable_to_bson 문서 가 변환할 수 없는 경우입니다.(문서가 변환할 수 없는 경우) ⇒ 객체 사용 중단 더 이상 사용되지 않습니다.
인스턴스 메서드 요약 접기
-
#__evolve_object_id__ ⇒ string | BSON::ObjectId
가능하면 string 을 객체 ID 로 변환합니다.
-
#__mongoize_object_id__ ⇒ string | BSON::ObjectId | nil
가능하면 string 을 객체 ID 로 몽고화합니다.
-
#__mongoize_time__ ⇒ 시간 | ActiveSupport::TimeWithZone
저장 을 위해 string 을 몽고화합니다.
-
#before_type_cast? ⇒ true | false
string 이 _before_type_cast로 끝나나요?
-
#collectionize ⇒ string
string 을 컬렉션 에 친숙한 이름으로 변환합니다.
- #mongoid_id? ⇒ true | false 사용 중단 더 이상 사용되지 않습니다.
-
#숫자? ⇒ true | false
Is the string a number? The literals "NaN", "Infinity", and "-Infinity" are counted as numbers.
-
#판독기 ⇒ string
string 을 getter string 로 가져옵니다.
- #unconvertable_to_bson? ⇒ true | false 사용 중단 더 이상 사용되지 않습니다.
-
#valid_method_name? ⇒ true | false
이 string 이 valid_method_name인가요?
-
#작성자? ⇒ true | false
이 string 은 작성기인가요?
인스턴스 속성 세부 정보
#unconvertable_to_bson ⇒ 객체
9 10 11 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 9 def unconvertable_to_bson @unconvertable_to_bson end |
#unconvertable_to_bson 문서 가 변환할 수 없는 경우입니다.(문서가 변환할 수 없는 경우) ⇒ 객체
9 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 9 attr_accessor :unconvertable_to_bson |
인스턴스 메서드 세부 정보
#__evolve_object_id__ ⇒ string | BSON::ObjectId
가능하면 string 을 객체 ID 로 변환합니다.
19 20 21 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 19 def __evolve_object_id__ convert_to_object_id end |
#__mongoize_object_id__ ⇒ string | BSON::ObjectId | nil
가능하면 string 을 객체 ID 로 몽고화합니다.
29 30 31 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 29 def __mongoize_object_id__ convert_to_object_id 하지 않는 한 비어 있나요? end |
#__mongoize_time__ ⇒ 시간 | ActiveSupport::TimeWithZone
기본 시간대의 현지 시간을 반환합니다.
저장 을 위해 string 을 몽고화합니다.
45 46 47 48 49 50 51 52 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 45 def __mongoize_time__ # 이 예비 Time.parse는 string이 다음과 같은 경우 오류를 발생시키는 데 필요합니다. #은(는) 유효한 시간 string 이 아닙니다. ActiveSupport::TimeZone은 # 이 검사를 수행합니다. ::시간.parse(self) ::시간.영역.parse(self) end |
#before_type_cast? ⇒ true | false
string 이 _before_type_cast로 끝나나요?
125 126 127 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 125 def before_type_cast? endpoints_with?('_before_type_cast') end |
#collectionize ⇒ string
string 을 컬렉션 에 친숙한 이름으로 변환합니다.
60 61 62 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 60 def collectionize tableize.tr('/', '_') end |
#mongoid_id? ⇒ true | false
string 이 Mongoid ID 에 유효한 값입니까?
71 72 73 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 71 def mongoid_id? self =~ /\A(|_)id\z/ end |
#숫자? ⇒ true | false
Is the string a number? The literals "NaN", "Infinity", and "-Infinity" are counted as numbers.
83 84 85 86 87 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 83 def 숫자? !!Float(self) 구출 ArgumentError (self =~ /\A(?:NaN|-?Infinity)\z/) == 0 end |
#판독기 ⇒ string
string 을 getter string 로 가져옵니다.
95 96 97 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 95 def 리더 삭제('=').sub(/_before_type_cast\z/, '') end |
#unconvertable_to_bson? ⇒ true | false
기준 생성 시 객체 를 BSON 으로 변환하지 않나요?
136 137 138 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 136 def unconvertable_to_bson? @unconvertable_to_bson ||= 거짓 end |
#valid_method_name? ⇒ true | false
이 string 이 valid_method_name인가요?
115 116 117 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 115 def valid_method_name? /[@$"-]/ !~ self end |
#작성자? ⇒ true | false
이 string 이 작성기인가요?
105 106 107 |
# 파일 'lib/mongoid/extensions/string.rb', 줄 105 def 작가? 포함?('=') end |